ZEXP.áµ(cOFS.Folder Folder q)tq.}q(U add_fs_imageqU.âqQU config_okqU.ãqQU contributeursq(Uzwook@matisson.comq tq Uunzip_file_formq U.äq QU zwo_new_htmlq U.åqQUedit_okqU.æqQUskinqU1UimagesqU.çqQUnew_okqU.èqQU__ac_local_roles__q}qUzwo_config_htmlqU.éqQUidqUalbum_photo_jqueryqUmove_imgqU.êqQUunzip_file_scriptqU.ëqQU certifwebq Unonq!Uview_imgq"U.ìq#QUadd_fs_thumbnailq$U.íq%QUtitleq&UAlbum-photo-jqueryq'U rotate90fsq(U.îq)QUnoteq*MÊUversionq+U2.10q,U add_image_okq-U.ïq.QU_objectsq/(}q0(U meta_typeq1UScript (Python)q2Uidq3Unew_okq4u}q5(U meta_typeq6UScript (Python)q7Uidq8U add_imageq9u}q:(U meta_typeq;UScript (Python)q(U meta_typeq?UScript (Python)q@UidqAUdel_imgqBu}qC(U meta_typeqDUScript (Python)qEUidqFh"u}qG(U meta_typeqHUScript (Python)qIUidqJU edit_htmlqKu}qL(hHhIhJhu}qM(U meta_typeqNUImageqOUidqPU icone.pngqQu}qR(U meta_typeqSUScript (Python)qTUidqUU thumbscriptqVu}qW(hSUExternal MethodqXhUU thumbnailqYu}qZ(U meta_typeq[UScript (Python)q\Uidq]U zwo_new_htmlq^u}q_(h[h\h]U zwo_view_htmlq`u}qa(h[h\h]hu}qb(U meta_typeqcUScript (Python)qdUidqeU move_htmlqfu}qg(hchdhehu}qh(U meta_typeqiUScript (Python)qjUidqkhu}ql(U meta_typeqmUExternal MethodqnUidqoUtestPILqpu}qq(hmUScript (Python)qrhoU testPILscriptqsu}qt(U meta_typequUExternal MethodqvUidqwUrotate90qxu}qy(huUScript (Python)qzhwUrotate90scriptq{u}q|(U meta_typeq}UFolderq~UidqU Extensionsq€u}q(U meta_typeq‚UExternal MethodqƒUidq„U unzip_fileq…u}q†(h‚UScript (Python)q‡h„hu}qˆ(U meta_typeq‰UScript (Python)qŠUidq‹Uadd_fileqŒu}q(U meta_typeqŽUScript (Python)qUidqh u}q‘(U meta_typeq’UExternal Methodq“Uidq”Uzip_fileq•u}q–(h’UScript (Python)q—h”Uzip_file_scriptq˜u}q™(U meta_typeqšUScript (Python)q›UidqœUtestqu}qž(U meta_typeqŸUFolderq Uidq¡U javascriptq¢u}q£(U meta_typeq¤UFolderq¥Uidq¦Ucssq§u}q¨(U meta_typeq©UExternal MethodqªUidq«U add_fs_imageq¬u}q­(U meta_typeq®UExternal Methodq¯Uidq°Uadd_fs_thumbnailq±u}q²(U meta_typeq³UExternal Methodq´UidqµU rotate90fsq¶u}q·(U meta_typeq¸UExternal Methodq¹UidqºU del_img_fsq»u}q¼(U meta_typeq½UFolderq¾Uidq¿UimagesqÀu}qÁ(U meta_typeqÂUScript (Python)qÃUidqÄUdownload_imageqÅu}qÆ(U meta_typeqÇUExternal MethodqÈUidqÉUget_fileqÊu}qË(U meta_typeqÌUExternal MethodqÍUidqÎUget_fdqÏu}qÐ(U meta_typeqÑUExternal MethodqÒUidqÓUzodb2fsqÔutqÕhxU.ðqÖQh˜U.ñq×QU thumbnailqØU.òqÙQUcssqÚU.óqÛQhKU.ôqÜQU thumbscriptqÝU.õqÞQU descriptionqß(UÀAffiche un album photo, sous forme de pages de vignettes. Chaque image est affichée en taille réelle lorsqu'on clique sur sa vignette, et peut être accompagnée d'un titre et d'une description.qàU2La taille maximale des vignettes est paramétrable.qáU”Si la librairie graphique PIL est installée, ainsi que les extensions thumbnail.py, rotate90.py et testPIL.py (ce qui est le cas sur un ZEServer) :qâUE- les vignettes des images téléchargées sont automatiquement créées ;qãUA- il est possible de faire subir aux images des rotations de 90°.qäUL- il est aussi possible d'importer ou d'exporter des images en dossier zipé.qåtqæhBU.öqçQh•U.÷qèQU javascriptqéU.øqêQh9U.ùqëQhŒU.úqìQhsU.ûqíQUtestqîU.üqïQU ExtensionsqðU.ýqñQU _propertiesqò(}qó(UtypeqôUstringqõUidqöUtitleq÷UmodeqøUwu}qù(UtypeqúUstringqûUidqüU experimentalqýu}qþ(UtypeqÿUintrUidrUnoteru}r(hÿUstringrjUversionru}r(hÿjjUdevru}r(hÿjjU certifdevr u}r (hÿjjU certifwebr u}r (hÿjjU moderateurr u}r(UtyperUlinesrUidrU descriptionru}r(UtyperUlinesrUidrhu}r(UtyperUstringrUidrhu}r(jjjUzone_principaleru}r(UtyperUstringrUidr U access_redacr!utr"UtestPILr#U.þr$QU certifdevr%Unonr&U access_redacr'Uutilisable par un rédacteurr(hÅU.ÿr)QU del_img_fsr*U/r+QUdevr,U100%r-Uget_filer.U/r/QhfU/r0Qh…U/r1QU_ownerr2(]r3(Uvirtualr4U emencia.netr5U acl_usersr6eUrage2000r7tr8jU1h{U/r9QhQU/r:QU zwo_view_htmlr;U/r<QU moderateurr=Uclaudiux@zwookedu.netr>Uzodb2fsr?U/r@QU experimentalrAUUget_fdrBU/rCQu..âÑ(cProducts.ExternalMethod.ExternalMethod ExternalMethod q)tq.}q(U_moduleqUfilemanagementqU _functionqU write_fileqU__ac_local_roles__q}q Urage2000q ]q UOwnerq asUidq U add_fs_imageqUtitleqUu..ã:(cProducts.PythonScripts.PythonScript PythonScript q)tq.}q(U Python_magicqUmò qU _proxy_rolesq(UManagerqtqUwarningsq )U Script_magicq KU_bodyq T’# RECUPERATION DES PARAMETRES mem=context.zwo_lib.mem_mod_data() if type_rep=="skin": try: skin=context.zwo_info.skins[nom_rep] except: return 'nooo' obj=skin[instid] else: dossier=mem['rep_obj'] obj=dossier[instid] if mem['droit_edit_dossier']<>1 and not context.zwo_lib.droit_redac(mem,obj): return 'Vous n\'avez pas les droits pour cette action !' # EXEMPLE MODIFICATION #obj.manage_changeProperties(exemple=exemple) if obj.hasProperty('num_of_lines'): obj.manage_changeProperties(num_of_lines=num_of_lines) else: obj.manage_addProperty('num_of_lines',num_of_lines,'int') if obj.hasProperty('img_per_line'): obj.manage_changeProperties(img_per_line=img_per_line) else: obj.manage_addProperty('img_per_line',img_per_line,'int') if obj.hasProperty('biggest_width'): obj.manage_changeProperties(biggest_width=biggest_width) else: obj.manage_addProperty('biggest_width',biggest_width,'int') if obj.hasProperty('show_title'): obj.manage_changeProperties(show_title=show_title) else: obj.manage_addProperty('show_title',show_title,'string') if obj.hasProperty('show_desc'): obj.manage_changeProperties(show_desc=show_desc) else: obj.manage_addProperty('show_desc',show_desc,'string') img_width_max,img_height_max=dim_max.split('x') if obj.hasProperty('img_width_max'): obj.manage_changeProperties(img_width_max=img_width_max) else: obj.manage_addProperty('img_width_max',img_width_max,'int') if obj.hasProperty('img_height_max'): obj.manage_changeProperties(img_height_max=img_height_max) else: obj.manage_addProperty('img_height_max',img_height_max,'int') if obj.hasProperty('filesystem'): obj.manage_changeProperties(filesystem=isfs) else: obj.manage_addProperty('filesystem', isfs, 'boolean') # Rédacteurs: if mem['droit_redac']==1: if obj.hasProperty('redac_time'): obj.manage_changeProperties(redac_time=DateTime()) else: obj.manage_addProperty('redac_time',DateTime(),'date') elif mem['droit_edit_dossier']==1: context.zwo_lib.check_content_submited_by_redac(obj.getId(), obj.absolute_url(), 'chown', redacteur, imprimatur) # REDIRECTION PAGE ADMIN GENERALE PAGE OU SKIN. context.REQUEST.RESPONSE.redirect('../../') q U _filepathq U?Script (Python):/zwookedu_0.7/zwo_modules/album_photo/config_okqU_codeqT c@sddddded„ZdS(Ntt0t640x480c DCs#tttdƒdƒƒ}|djoFy%ttttdƒdƒ|ƒ}Wn dSnXt||ƒ}nt|dƒ}t||ƒ}t|dƒd jo tttdƒd ƒ||ƒ od Snt|d ƒd ƒot|dƒd |ƒnt|dƒd |dƒt|d ƒdƒot|dƒd|ƒnt|dƒd|dƒt|d ƒdƒot|dƒd|ƒnt|dƒd|dƒt|d ƒdƒot|dƒd| ƒnt|dƒd| dƒt|d ƒdƒot|dƒd| ƒnt|dƒd| dƒt|dƒdƒtƒ\}}t|d ƒdƒot|dƒd|ƒnt|dƒd|dƒt|d ƒdƒot|dƒd|ƒnt|dƒd|dƒt|d ƒdƒot|dƒd| ƒnt|dƒd| dƒt|d ƒd joSt|d ƒdƒot|dƒdtƒƒnt|dƒdtƒdƒn[t|dƒd joDtttdƒdƒt|dƒƒt|d ƒƒd!||ƒnttttd"ƒd#ƒd$ƒd%ƒdS(&Ntzwo_libt mem_mod_datatskintzwo_infotskinstnoootrep_objtdroit_edit_dossierit droit_redacs.Vous n'avez pas les droits pour cette action !t hasPropertyt num_of_linestmanage_changePropertiestmanage_addPropertytintt img_per_linet biggest_widtht show_titletstringt show_desctsplittxt img_width_maxtimg_height_maxt filesystemtbooleant redac_timetdatetcheck_content_submited_by_redactgetIdt absolute_urltchowntREQUESTtRESPONSEtredirects../../(t _getattr_tcontexttmemttype_rept _getitem_tnom_repRtinstidtobjtdossierR RRRRtdim_maxt _getiter_RRtisfstDateTimet redacteurt imprimatur(R+R*R(R RRR2R3R.RRR0R%R&R'R)RR,R-R/RRR1((sScript (Python)s config_oksT (9" D(tFalset config_ok(R4R5((sScript (Python)sRqU func_defaultsq(UU0U640x480qU0U0I00 tqUerrorsq)U _bind_namesq(cShared.DC.Scripts.Bindings NameAssignments qoq}qU_asgnsq}q(U name_contextqUcontextqU name_subpathqUtraverse_subpathqU name_m_selfqUscriptq Uname_containerq!U containerq"usbU_dav_writelocksq#U/ q$QU__ac_local_roles__q%}q&Uxavq']q(UOwnerq)asUidq*U config_okq+U_paramsq,Užinstid, nom_rep, type_rep, num_of_lines, img_per_line, biggest_width,redacteur='',imprimatur='0', dim_max='640x480', show_title='0', show_desc='0', isfs=Falseq-U func_codeq.(cShared.DC.Scripts.Signature FuncCode q/oq0}q1(U co_argcountq2K U co_varnamesq3(Uinstidq4Unom_repq5Utype_repq6U num_of_linesq7U img_per_lineq8U biggest_widthq9U redacteurq:U imprimaturq;Udim_maxqUisfsq?U _getattr_q@UcontextqAUmemqBU _getitem_qCUskinqDUobjqEUdossierqFU _getiter_qGU img_width_maxqHUimg_height_maxqIUDateTimeqJtqKubu..ä :(cProducts.PythonScripts.PythonScript PythonScript q)tq.}q(U Python_magicqUmò qUerrorsq)Uwarningsq)U Script_magicqKU_bodyq Thmem=context.zwo_lib.mem_data() print context.zwo_lib.standard_html_header(mem) print """ Votre fichier ZIP ne doit contenir que des images ou des photos.
Fichier ZIP :
""" %(instid) print context.zwo_lib.standard_html_footer(mem) return printed q U _filepathq UOScript (Python):/zwook_active_kz1_0_rc1/zwo_modules/album_photo/unzip_file_formq U_codeq TÐc@s d„ZdS(Nc Cstƒ}tttdƒdƒƒ}|tttdƒdƒ|ƒIJ|d|IJ|tttdƒdƒ|ƒIJ|ƒSdS(Ntzwo_libtmem_datatstandard_html_headersÁ Votre fichier ZIP ne doit contenir que des images ou des photos.
Fichier ZIP :
tstandard_html_footer(t_print_t_printt _getattr_tcontexttmemtinstid(R RRRRR((sScript (Python)tunzip_file_forms $" "(R (R ((sScript (Python)stqU func_defaultsqNU _bind_namesq(cShared.DC.Scripts.Bindings NameAssignments qoq}qU_asgnsq}q(Uname_containerqU containerqU name_contextqUcontextqU name_subpathqUtraverse_subpathqU name_m_selfqUscriptqusbU func_codeq(cShared.DC.Scripts.Signature FuncCode qoq }q!(U co_argcountq"KU co_varnamesq#(Uinstidq$U_print_q%U_printq&U _getattr_q'Ucontextq(Umemq)tq*ubU__ac_local_roles__q+}q,Uclaudiuxq-]q.UOwnerq/asUidq0Uunzip_file_formq1U_paramsq2Uinstidq3U_dav_writelocksq4U/ q5Qu..å (cProducts.PythonScripts.PythonScript PythonScript q)tq.}q(U Python_magicqUmò qUerrorsq)Uwarningsq)U Script_magicqKU_bodyq TÛ if mem['droit_edit_dossier']<>1 and mem['droit_redac']!=1: return "Vous n'avez pas les droits pour cette action !" # typemod est l'id du module et namemod est son title typemod=container.getId() namemod=container.title_or_id() # La bibliothèque PIL est-elle présente ? PIL_present=0 try: PIL_present=context.zwo_modules[typemod].testPILscript() except: PIL_present=0 PIL_present=int(PIL_present) # proposition de nom pour l'element exemple_titre_base=namemod exemple_titre=exemple_titre_base indice=0 while exemple_titre in dossier.objectIds(): indice=indice+1 exemple_titre=exemple_titre_base+str(indice) # debut formulaire HTML simple de création d'element print '
' print '' print 'Identifiant :

' # partie specifique à ce module #print '
EXEMPLE
' print '''Cet album photographique va contenir des pages de lignes de vignettes (plus grande longueur : pixels, dimensions proportionnelles à celles de la photo).
En cliquant sur une vignette, le visiteur pourra voir la photo dans un cadre dont les dimensions n'excèderont pas :
En cliquant à nouveau sur cette photo, il la verra en vraie grandeur.

Chaque vignette/photo peut être affublée d'un titre et/ou d'une description.
Désirez-vous :
Afficher le titre au-dessus de la vignette ou photo.
Afficher la description en-dessous de la vignette ou photo.

Chaque vignette/photo peut être stocker en file systeme ou en zodb.
Désirez-vous :
Stocker les images en file systeme.
''' # suite standard print '' print '
' if PIL_present==1: print """La bibliothèque PIL (Python Image Library) étant présente sur votre serveur web, vous n'aurez pas besoin d'envoyer sur le site les vignettes de vos photos : celles-ci seront créées automatiquement, avec sa plus grande dimension égale à celle choisie ci-dessus.""" return mem['racine_obj'].zwo_lib.trad.trans(printed,context.zwo_new_html.absolute_url()) q U _filepathq UFScript (Python):/kzexp_stable_1.0/zwo_modules/album_photo/zwo_new_htmlq U_codeq TÐ c@s d„ZdS(Nc#Cs¬tƒ}t|dƒdjot|dƒdjodSnttdƒƒ}ttdƒƒ}d} y(tttt dƒ|ƒd ƒƒ} Wn d} nXt | ƒ} |} | } d}x8| t|d ƒƒjo|d}| t|ƒ} qÀW|d |d IJ|d IJ|d| dIJ|dIJ|dIJ|dIJ| djo|dIJntttt|dƒdƒdƒdƒ|ƒttt dƒdƒƒƒSdS(Ntdroit_edit_dossierit droit_redacs.Vous n'avez pas les droits pour cette action !tgetIdt title_or_idit zwo_modulest testPILscriptt objectIdss(
ss?Identifiant :

sCet album photographique va contenir des pages de lignes de vignettes (plus grande longueur : pixels, dimensions proportionnelles à celles de la photo).
En cliquant sur une vignette, le visiteur pourra voir la photo dans un cadre dont les dimensions n'excèderont pas :
En cliquant à nouveau sur cette photo, il la verra en vraie grandeur.

Chaque vignette/photo peut être affublée d'un titre et/ou d'une description.
Désirez-vous :
Afficher le titre au-dessus de la vignette ou photo.
Afficher la description en-dessous de la vignette ou photo.

Chaque vignette/photo peut être stocker en file systeme ou en zodb.
Désirez-vous :
Stocker les images en file systeme.
s0s
sLa bibliothèque PIL (Python Image Library) étant présente sur votre serveur web, vous n'aurez pas besoin d'envoyer sur le site les vignettes de vos photos : celles-ci seront créées automatiquement, avec sa plus grande dimension égale à celle choisie ci-dessus.t racine_objtzwo_libttradttranst zwo_new_htmlt absolute_url(t_print_t_printt _getitem_tmemt _getattr_t containerttypemodtnamemodt PIL_presenttcontexttinttexemple_titre_baset exemple_titretindicetdossiertstr(RRR RRRRRRRRRRRRR((sScript (Python)s zwo_new_htmls05+        (R (R ((sScript (Python)stqU func_defaultsqNU _bind_namesq(cShared.DC.Scripts.Bindings NameAssignments qoq}qU_asgnsq}q(Uname_containerqU containerqU name_m_selfqUscriptqU name_subpathqUtraverse_subpathqU name_contextqUcontextqusbU_dav_writelocksqU/ qQU__ac_local_roles__q }q!Uxavq"]q#UOwnerq$asUidq%U zwo_new_htmlq&U_paramsq'U mem,dossierq(U func_codeq)(cShared.DC.Scripts.Signature FuncCode q*oq+}q,(U co_argcountq-KU co_varnamesq.(Umemq/Udossierq0U_print_q1U_printq2U _getitem_q3U _getattr_q4U containerq5Utypemodq6Unamemodq7U PIL_presentq8Ucontextq9Uintq:Uexemple_titre_baseq;U exemple_titreqtq?ubu..æ;(cProducts.PythonScripts.PythonScript PythonScript q)tq.}q(U Python_magicqUmò qU _proxy_rolesq(UManagerqtqUwarningsq )U Script_magicq KU_bodyq T*# RECUPERATION DES PARAMETRES mem=context.zwo_lib.mem_mod_data() lieu=mem['rep_obj'][instid] #lieu=mem['parent'] # url_lieu=mem['parent_url'] obj=lieu[imgid] thumbnail=obj.thumbnail module_src = context.zwo_modules[lieu.element] if mem['droit_edit_dossier']<>1 and not context.zwo_lib.droit_redac(mem,lieu): return 'Vous n\'avez pas les droits pour cette action !' sizes = ('octets', 'Ko', 'Mo', 'Go', 'To') def human_size(size): size = float(size) unity = 0 while size >= 1024 and unity < len(sizes)-1: size = size/1024 unity += 1 return "%0.2f %s" % (size, sizes[unity]) def img_time(x): """ Retourne le time (fake s'il existe, réel sinon) de l'image""" if x.hasProperty('faketime'): return DateTime(x.faketime) else: return DateTime(x.bobobase_modification_time()) # end of def img_time(x) # upload nouvelle image faketime=DateTime() wasfs = False path = mem['rep_url'].replace(mem['zwo_url'],'') path = path.split('/') if obj.element == 'fs_image': wasfs = True file_path = obj.file_path content_type = obj.content_type if data is not None: data_stream = data.read() else: data_stream = '' if len(data_stream)<=0: if isfs != wasfs: obj = context.zodb2fs(obj, lieu, path) if not obj.hasProperty('faketime'): obj.manage_addProperty('faketime',faketime,'date') rec_tn = 1 content_type = obj.content_type file_path = obj.file_path else: obj.manage_changeProperties(title=context.REQUEST.titre) obj.manage_changeProperties(description=context.REQUEST.description) obj.manage_changeProperties(affiche_titre=affiche_titre_change) obj.manage_changeProperties(affiche_description=affiche_description_change) if not obj.hasProperty('faketime'): obj.manage_addProperty('faketime',faketime,'date') if len(data_stream) > 0: if isfs != wasfs: rec_tn = 1 dossier=lieu faketime=img_time(obj) if wasfs: module_src.del_img_fs(obj.file_path) dossier.manage_delObjects([imgid]) if isfs: file_path, size = module_src.add_fs_image(data, subpath=path) width, height = size content_type = data.headers['Content-Type'] dossier.manage_addDTMLDocument(imgid, context.REQUEST.titre) dossier[imgid].manage_addProperty('alt', context.REQUEST.titre, 'string') dossier[imgid].manage_addProperty('content_type', content_type, 'string') dossier[imgid].manage_addProperty('height', height, 'string') dossier[imgid].manage_addProperty('width', width, 'string') type = 'fs_image' else: dossier.manage_addImage(imgid,data,context.REQUEST.titre) type = 'image' file_path = '' obj = dossier[imgid] obj.manage_addProperty('type_zwook','element','string') obj.manage_addProperty('element', type,'string') obj.manage_addProperty('description',context.REQUEST.description,'lines') obj.manage_addProperty('affiche_description',affiche_description_change,'string') obj.manage_addProperty('affiche_titre',affiche_titre_change,'string') obj.manage_addProperty('thumbnail',thumbnail,'int') obj.manage_addProperty('faketime',faketime,'date') obj.manage_addProperty('file_path',file_path,'string') # upload nouveau thumbnail if lieu.hasProperty('biggest_width'): biggest_width=int(lieu.biggest_width) else: biggest_width=105 if biggest_width<1: biggest_width=105 dossierthumb=lieu['thumbnails'] if rec_tn==1: # on (re-)calcule le thumbnail: if imgid in dossierthumb.objectIds(): if wasfs: module_src.del_img_fs(dossierthumb[imgid].file_path) dossierthumb.manage_delObjects([imgid]) if isfs: thumb_path, size = module_src.add_fs_thumbnail(file_path, size=biggest_width) width, height = size if imgid in dossierthumb.objectIds(): dossierthumb.manage_delObjects([imgid]) dossierthumb.manage_addDTMLDocument(imgid, context.REQUEST.titre) thumbobj = dossierthumb[imgid] thumbobj.manage_addProperty('file_path', thumb_path, 'string') thumbobj.manage_addProperty('alt', context.REQUEST.titre, 'string') thumbobj.manage_addProperty('content_type', content_type, 'string') thumbobj.manage_addProperty('height', height, 'string') thumbobj.manage_addProperty('width', width, 'string') obj.manage_changeProperties(thumbnail=1) else: context.thumbscript(obj,imgid,biggest_width) elif not (not thumb or len(thumb.read())<=0): if imgid in dossierthumb.objectIds(): if wasfs: module_src.del_img_fs(dossierthumb[imgid].file_path) dossierthumb.manage_delObjects([imgid]) if isfs: obj.manage_changeProperties(thumbnail=1) thumb_path = path + ['thumbnail'] thumb_path, size = context.add_fs_image(thumb, subpath=thumb_path) width, height = size dossierthumb.manage_addDTMLDocument(imgid, context.REQUEST.titre) thumbobj = dossierthumb[imgid] thumbobj.manage_addProperty('file_path', thumb_path, 'string') thumbobj.manage_addProperty('alt', context.REQUEST.titre, 'string') thumbobj.manage_addProperty('content_type', thumb.headers['Content-Type'], 'string') thumbobj.manage_addProperty('height', height, 'string') thumbobj.manage_addProperty('width', width, 'string') else: dossierthumb.manage_addImage(imgid,thumb,obj.title) obj.manage_changeProperties(thumbnail=1) if 'hdfile' in obj.propertyIds(): have_hd_file = obj.hdfile else: have_hd_file = 0 hdfile_stream = hdfile.read() if del_hd_file == 1 or len(hdfile_stream) > 0: if 'hdfile' in obj.propertyIds() and obj.hdfile == 1: hd_obj = lieu['hd'][imgid] module_src.del_img_fs(hd_obj.file_path) lieu['hd'].manage_delObjects([imgid]) if len(hdfile_stream) > 0: have_hd_file = 1 hd_path = path + ['hd'] hd_path, size = context.add_fs_image(hdfile, subpath=hd_path) width, height = size if 'hd' not in lieu.objectIds(): lieu.manage_addFolder('hd', 'HD files') lieu['hd'].manage_addDTMLDocument(imgid, context.REQUEST.titre) hdobj = lieu['hd'][imgid] hdobj.manage_addProperty('file_path', hd_path, 'string') size = human_size(len(hdfile_stream)) hdobj.manage_addProperty('size', size, 'string') hdobj.manage_addProperty('content_type', data.headers['Content-Type'], 'string') hdobj.manage_addProperty('height', height, 'string') hdobj.manage_addProperty('width', width, 'string') if 'hdfile' in obj.propertyIds(): obj.manage_changeProperties(hdfile=have_hd_file) else: obj.manage_addProperty('hdfile', have_hd_file, 'int') try: num_page_album=int(context.REQUEST.form['num_page_album']) except: num_page_album=1 if num_page_album!=1: param_redirect='?num_page_album='+str(num_page_album) else: param_redirect='' # REDIRECTION PAGE ADMIN GENERALE PAGE OU SKIN. context.REQUEST.RESPONSE.redirect('../../'+param_redirect) q Uidq Uedit_okqU_codeqT4c@sdddedd„ZdS(Nt0ic 34s0 tttdƒdƒƒ} tt| dƒ|ƒ}t||ƒ}t|dƒ}tttdƒt|dƒƒ}t| dƒdjo tttdƒd ƒ| |ƒ od Snd d d ddf‰‡d†}d„}t ƒ}t}tt| dƒdƒt| dƒdƒ}t|dƒdƒ}t|dƒdjo(t}t|dƒ}t|dƒ}n|tj ot|dƒƒ}nd}t|ƒdjo8||jowttdƒ|||ƒ}t|dƒdƒ ot|d ƒd|d!ƒnd}t|dƒ}t|dƒ}n±t|d"ƒd#tttd$ƒd%ƒƒt|d"ƒd&tttd$ƒd&ƒƒt|d"ƒd'|ƒt|d"ƒd(|ƒt|dƒdƒ ot|d ƒd|d!ƒnnt|ƒdjo°||jo d}n|} ||ƒ}|o6t|d)ƒt|dƒƒt| d*ƒ|gƒn|ot|d+ƒ|d,|ƒtƒ\}}"|"tƒ\}#}$tt|d-ƒd.ƒ}t| d/ƒ|tttd$ƒd%ƒƒtt| |ƒd ƒd0tttd$ƒd%ƒd1ƒtt| |ƒd ƒd|d1ƒtt| |ƒd ƒd2|$d1ƒtt| |ƒd ƒd3|#d1ƒd}%n8t| d4ƒ||tttd$ƒd%ƒƒd5}%d}t| |ƒ}t|d ƒd6dd1ƒt|d ƒd|%d1ƒt|d ƒd&tttd$ƒd&ƒd7ƒt|d ƒd(|d1ƒt|d ƒd'|d1ƒt|d ƒd|d8ƒt|d ƒd|d!ƒt|d ƒd|d1ƒnt|dƒd9ƒot#t|d9ƒƒ}'nd:}'|'djo d:}'nt|d;ƒ}(|djoÕ|t|(d<ƒƒjoJ|o)t|d)ƒtt|(|ƒdƒƒnt|(d*ƒ|gƒn|oNt|d=ƒ|d>|'ƒtƒ\})}"|"tƒ\}#}$|t|(d<ƒƒjot|(d*ƒ|gƒnt|(d/ƒ|tttd$ƒd%ƒƒt|(|ƒ}*t|*d ƒd|)d1ƒt|*d ƒd0tttd$ƒd%ƒd1ƒt|*d ƒd|d1ƒt|*d ƒd2|$d1ƒt|*d ƒd3|#d1ƒt|d"ƒddƒnttd?ƒ|||'ƒn | ptt|dƒƒƒdj oà|t|(d<ƒƒjoJ|o)t|d)ƒtt|(|ƒdƒƒnt|(d*ƒ|gƒn|o:t|d"ƒddƒ|dg})ttd+ƒ|d,|)ƒtƒ\})}"|"tƒ\}#}$t|(d/ƒ|tttd$ƒd%ƒƒt|(|ƒ}*t|*d ƒd|)d1ƒt|*d ƒd0tttd$ƒd%ƒd1ƒt|*d ƒdtt|d-ƒd.ƒd1ƒt|*d ƒd2|$d1ƒt|*d ƒd3|#d1ƒn9t|(d4ƒ||t|d#ƒƒt|d"ƒddƒnd@t|dAƒƒjot|d@ƒ}+nd}+t|dƒƒ},| djpt|,ƒdjoŠd@t|dAƒƒjot|d@ƒdjoWtt|dBƒ|ƒ}-t|d)ƒt|-dƒƒtt|dBƒd*ƒ|gƒnnt|,ƒdjood}+|dBg}.ttd+ƒ|d,|.ƒtƒ\}.}"|"tƒ\}#}$dBt|d<ƒƒjot|dCƒdBdDƒntt|dBƒd/ƒ|tttd$ƒd%ƒƒtt|dBƒ|ƒ}/t|/d ƒd|.d1ƒ|t|,ƒƒ}"t|/d ƒd>|"d1ƒt|/d ƒdtt|d-ƒd.ƒd1ƒt|/d ƒd2|$d1ƒt|/d ƒd3|#d1ƒnd@t|dAƒƒjot|d"ƒd@|+ƒnt|d ƒd@|+d8ƒy+t#ttttd$ƒdEƒdFƒƒ}0Wn d}0nX|0djodGt1|0ƒ}2nd}2ttttd$ƒdHƒdIƒdJ|2ƒdKS(Ls; Retourne le time (fake s'il existe, réel sinon) de l'imagetzwo_libt mem_mod_datatrep_objt thumbnailt zwo_modulestelementtdroit_edit_dossierit droit_redacs.Vous n'avez pas les droits pour cette action !toctetstKotMotGotTocsut|ƒ}d}xE|djo|tˆƒdjo |d}td|dƒ}qWd|tˆ|ƒfSdS(Niiis+=s%0.2f %s(tfloattsizetunitytlentsizest _inplacevar_t _getitem_(RRRRRRR(R(sScript (Python)s human_sizes $ cCsGt|dƒdƒott|dƒƒSntt|dƒƒƒSdS(s; Retourne le time (fake s'il existe, réel sinon) de l'imaget hasPropertytfaketimetbobobase_modification_timeN(t _getattr_txtDateTime(RRR((sScript (Python)simg_timestrep_urltreplacetzwo_urlttsplitt/tfs_imaget file_patht content_typetreaditzodb2fsRRtmanage_addPropertytdatetmanage_changePropertiesttitletREQUESTttitret descriptiont affiche_titretaffiche_descriptiont del_img_fstmanage_delObjectst add_fs_imagetsubpaththeaderss Content-Typetmanage_addDTMLDocumenttalttstringtheighttwidthtmanage_addImagetimaget type_zwooktlinestintt biggest_widthiit thumbnailst objectIdstadd_fs_thumbnailRt thumbscriptthdfilet propertyIdsthdtmanage_addFoldersHD filestformtnum_page_albums?num_page_album=tRESPONSEtredirects../../N(3RtcontexttmemRtinstidtlieutimgidtobjRt module_srcRt human_sizetimg_timeRRtFalsetwasfstpathtTrueR"R#tdatatNonet data_streamRtisfstrec_tntaffiche_titre_changetaffiche_description_changetdossiert _getiter_RR8R7ttypeR=R>t dossierthumbt thumb_pathtthumbobjtthumbt have_hd_fileRCt hdfile_streamt del_hd_filethd_objthd_paththdobjRHtstrtparam_redirect(3RMROReRXRCR]R^R\R[RhRRKRLRRNRPRRQRRRRSRRRTRURVRWR"R#RYRZRR_R`RR8R7RaR=R>RbRcRdRfRgRiRjRkRHRlRm((RsScript (Python)tedit_oks$!9  *  ((!   ((4""" ++   )(+() ((+" /' (1.  (RTRn(RTRn((sScript (Python)sRqU func_defaultsq(U0U0KI00 KtqUerrorsq)U _bind_namesq(cShared.DC.Scripts.Bindings NameAssignments qoq}qU_asgnsq}q(Uname_containerqU containerqU name_contextqUcontextqU name_subpathqUtraverse_subpathqU name_m_selfq Uscriptq!usbU func_codeq"(cShared.DC.Scripts.Signature FuncCode q#oq$}q%(U co_argcountq&K U co_varnamesq'(Uinstidq(Uimgidq)Uthumbq*Udataq+Uhdfileq,Uaffiche_titre_changeq-Uaffiche_description_changeq.Urec_tnq/Uisfsq0U del_hd_fileq1U _getattr_q2Ucontextq3Umemq4U _getitem_q5Ulieuq6Uobjq7U thumbnailq8U module_srcq9Usizesq:U human_sizeq;Uimg_timeqUFalseq?Uwasfsq@UpathqAUTrueqBU file_pathqCU content_typeqDUNoneqEU data_streamqFUlenqGUdossierqHU _getiter_qIUsizeqJUwidthqKUheightqLUtypeqMUintqNU biggest_widthqOU dossierthumbqPU thumb_pathqQUthumbobjqRU have_hd_fileqSU hdfile_streamqTUhd_objqUUhd_pathqVUhdobjqWUnum_page_albumqXUstrqYUparam_redirectqZtq[ubU__ac_local_roles__q\}q]Uxavq^]q_UOwnerq`asU _filepathqaU=Script (Python):/zwookedu_0.7/zwo_modules/album_photo/edit_okqbU_paramsqcUinstid, imgid, thumb, data, hdfile, affiche_titre_change='0', affiche_description_change='0', rec_tn=0, isfs=False, del_hd_file=0qdU_dav_writelocksqeU/ qfQu..ç«(cOFS.Folder Folder q)tq.}q(U arriere.pngqU/ qQU rotate_cw.pngqU/qQU remove.pngqU/q QU avant.pngq U/q QU alb_next.gifq U/q QU album.pngqU/qQU previous.pngqU/qQUidqUimagesqUnext.pngqU/qQU file_zip.pngqU/qQUtitleqUU cle_admin.pngqU/qQU download.gifqU/qQU_objectsq(}q(U meta_typeqUImageq Uidq!U ajouter.gifq"u}q#(hh h!hu}q$(hh h!hu}q%(hh h!h u}q&(hh h!hu}q'(hh h!Ucle_admin_no.pngq(u}q)(hh h!U eraser.pngq*u}q+(hh h!hu}q,(hh h!U fileopen.pngq-u}q.(hh h!Uici.pngq/u}q0(hh h!Uinfo.pngq1u}q2(hh h!U info_no.pngq3u}q4(hh h!U matrix.pngq5u}q6(hh h!Umove.pngq7u}q8(hh h!hu}q9(hh h!U package.pngq:u}q;(hh h!hu}q<(hh h!hu}q=(hh h!hu}q>(hh h!hu}q?(U meta_typeq@UImageqAUidqBh u}qC(U meta_typeqDUImageqEUidqFU alb_prev.gifqGu}qH(hDhEhFU close.gifqIu}qJ(U meta_typeqKUImageqLUidqMUajaxLoader.gifqNutqOhGU/qPQh3U/qQQh1U/qRQh:U/qSQh(U/qTQh-U/#qUQh7U/qVQh/U/qWQh"U/ qXQh5U/!qYQhNU/"qZQhIU/q[QU__ac_local_roles__q\}q]Urage2000q^]q_UOwnerq`ash*U/$qaQu..è³(cProducts.PythonScripts.PythonScript PythonScript q)tq.}q(U Python_magicqUmò qU _proxy_rolesq(UManagerqtqUwarningsq )U Script_magicq KU_bodyq Tí # RECUPERATION DES PARAMETRES mem=context.zwo_lib.mem_mod_data() if mem['droit_edit_dossier']<>1 and mem['droit_redac']!=1: return "Vous n'avez pas les droits pour cette action !" lieu=mem['parent'] url_lieu=mem['parent_bo_url'] idobj=context.zwo_lib.mix_id_zope(titre) img_width_max,img_height_max=dim_max.split('x') # REDIRECTION SI IDENTIFIANT MAL CHOISI if idobj in lieu.objectIds(): url='../ajout_element?type='+container.getId() print '' print '

Cet identifiant '+idobj+' est déja pris
' print 'Veuillez en choisir un autre
' print 'Redirection automatique dans 2 secondes.

' print 'Si la Redirection automatique ne fonctionne pas, cliquez ici : Redirection Manuelle' print '' return printed # CREATION INSTANCE MODULE (dossier, image, DTML Document ou Fichier selon Besoin. Folder conseillé en cas de doute) lieu.manage_addFolder(idobj,titre) lieu[idobj].manage_addFolder('thumbnails','thumbnails') lieu[idobj].manage_addFolder('hd','hd files') #lieu.manage_addImage(idobj,data,titre) #lieu.manage_addFile(idobj, file=data, title=titre) #lieu.manage_addDTMLDocument(idobj, titre) obj=lieu[idobj] # AJOUT DES PROPRIETES OBLIGATOIRE DU MODULES obj.manage_addProperty('type_zwook','element','string') obj.manage_addProperty('element',container.getId(),'string') # Ajouté pour rédacteur : if mem['droit_redac']==1: obj.manage_addProperty('redacteur',mem['user_id'],'string') obj.manage_addProperty('imprimatur',"0",'string') obj.manage_addProperty('redac_time',DateTime(),'date') # AJOUT D'AUTRES PROPRIETE en fonction du module obj.manage_addProperty('num_of_lines',int(num_of_lines),'int') obj.manage_addProperty('img_per_line',int(img_per_line),'int') obj.manage_addProperty('num_img',0,'int') obj.manage_addProperty('biggest_width',int(biggest_width),'int') obj.manage_addProperty('img_width_max', int(img_width_max),'int') obj.manage_addProperty('img_height_max', int(img_height_max),'int') obj.manage_addProperty('show_title', show_title, 'string') obj.manage_addProperty('show_desc', show_desc, 'string') obj.manage_addProperty('filesystem', isfs, 'boolean') # AJOUT DE SOUS ELEMENTS en fonction du module # (si dossier choisi comme type uniquement) #obj.manage_addFolder('truc','bidulle') #obj.truc.manage_addProperty('nom_propriete','valeur default',type) context.REQUEST.RESPONSE.redirect('../../place?obj='+idobj) return q U _filepathq U