From 878a2bb8716e0f10798a0e52d8e87d67fb422490 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Sep 15 2011 05:07:41 +0000 Subject: Reorganize Scripts directory structure inside the repository. --- diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/chapter-menu.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/chapter-menu.texinfo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/chapter-menu.texinfo diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/chapter-nodes.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/chapter-nodes.texinfo new file mode 100644 index 0000000..3e2dc0b --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/chapter-nodes.texinfo @@ -0,0 +1 @@ +@include =INCL= diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/chapter.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/chapter.texinfo new file mode 100644 index 0000000..33e9993 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/chapter.texinfo @@ -0,0 +1,12 @@ +@node =CHAPTER_NODE= +@chapter =CHAPTER_TITLE= +@cindex =CHAPTER_CIND= + +@c -- Chapter Introduction +... + +@c -- Chapter Menu +@include =CHAPTER_NAME=/chapter-menu.texinfo + +@c -- Chapter Nodes +@include =CHAPTER_NAME=/chapter-nodes.texinfo diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/section-functions.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/section-functions.texinfo new file mode 100644 index 0000000..7bf3dfd --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/section-functions.texinfo @@ -0,0 +1,34 @@ +@section =SECT= +@cindex =CIND= + +@subheading Name + +The @file{=SECT=} directory organizes @dots{} + +@subheading Synopsis + +@dots{} + +@subheading Description + +@dots{} + +@subheading Examples + +@dots{} + +@subheading Author + +Written by @dots{} + +@subheading Reporting bugs + +Report bugs to @email{centos-artwork@@centos.org} mailing list. + +@subheading Copyright + +Copyright @copyright{} =COPYRIGHT_YEAR_LIST= =COPYRIGHT_HOLDER= + +This is free software. You may redistribute copies of it under the +terms of the @ref{GNU General Public License}. There is NO WARRANTY, +to the extent permitted by law. diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/section.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/section.texinfo new file mode 100644 index 0000000..9461faa --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Chapters/section.texinfo @@ -0,0 +1,8 @@ +@node =NODE= +@section =SECT= +@cindex =CIND= + +... + +@c -- <[centos-art(SeeAlso) +@c -- ]> diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/GFDL.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/GFDL.texinfo new file mode 100755 index 0000000..c40cf38 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/GFDL.texinfo @@ -0,0 +1,414 @@ +Version 1.2, November 2002 + +@verbatim +Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA +@end verbatim + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +@subheading Preamble + +The purpose of this License is to make a manual, textbook, or other +functional and useful document ``free'' in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@subheading 1. Applicability and definitions + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The ``Document'', below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as ``you''. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not ``Transparent'' is called ``Opaque''. + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML, PostScript or PDF designed for human modification. Examples of +transparent image formats include PNG, XCF and JPG. Opaque formats +include proprietary formats that can be read and edited only by +proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML, PostScript or PDF produced by some word +processors for output purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +A section ``Entitled XYZ'' means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as ``Acknowledgements'', +``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the +Title'' of such a section when you modify the Document means that it +remains a section ``Entitled XYZ'' according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +@subheading 2. Verbatim copying + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no +other conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section @emph{3. +Copying in quantity}. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + +@subheading 3. Copying in quantity + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to +give them a chance to provide you with an updated version of the +Document. + +@subheading 4. Modifications + +You may copy and distribute a Modified Version of the Document under +the conditions of sections @emph{2. Verbatim copying} and @emph{3. +Copying in quantity} above, provided that you release the Modified +Version under precisely this License, with the Modified Version +filling the role of the Document, thus licensing distribution and +modification of the Modified Version to whoever possesses a copy of +it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions (which +should, if there were any, be listed in the History section of the +Document). You may use the same title as a previous version if the +original publisher of that version gives permission. + +B. List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +C. State on the Title page the name of the publisher of the Modified +Version, as the publisher. + +D. Preserve all the copyright notices of the Document. + +E. Add an appropriate copyright notice for your modifications adjacent +to the other copyright notices. + +F. Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +G. Preserve in that license notice the full lists of Invariant +Sections and required Cover Texts given in the Document's license +notice. + +H. Include an unaltered copy of this License. + +I. Preserve the section Entitled ``History'', Preserve its Title, and +add to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled ``History'' in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +J. Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise the +network locations given in the Document for previous versions it was +based on. These may be placed in the ``History'' section. You may +omit a network location for a work that was published at least four +years before the Document itself, or if the original publisher of the +version it refers to gives permission. + +K. For any section Entitled ``Acknowledgements'' or ``Dedications'', +Preserve the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +L. Preserve all the Invariant Sections of the Document, unaltered in +their text and in their titles. Section numbers or the equivalent are +not considered part of the section titles. + +M. Delete any section Entitled ``Endorsements''. Such a section may +not be included in the Modified Version. + +N. Do not retitle any existing section to be Entitled ``Endorsements'' +or to conflict in title with any Invariant Section. + +O. Preserve any Warranty Disclaimers. + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + +@subheading 5. Combining documents + +You may combine the Document with other documents released under this +License, under the terms defined in section @emph{4. Modifications} +above for modified versions, provided that you include in the +combination all of the Invariant Sections of all of the original +documents, unmodified, and list them all as Invariant Sections of your +combined work in its license notice, and that you preserve all their +Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled ``History'' +in the various original documents, forming one section Entitled +``History''; likewise combine any sections Entitled +``Acknowledgements'', +and any sections Entitled ``Dedications''. You must delete all sections +Entitled ``Endorsements''. + +@subheading 6. Collections of documents + +You may make a collection consisting of the Document and other +documents released under this License, and replace the individual +copies of this License in the various documents with a single copy +that is included in the collection, provided that you follow the rules +of this License for verbatim copying of each of the documents in all +other respects. + +You may extract a single document from such a collection, and +distribute it individually under this License, provided you insert a +copy of this License into the extracted document, and follow this +License in all other respects regarding verbatim copying of that +document. + +@subheading 7. Aggregation with independent works + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an ``aggregate'' if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section @emph{3. Copying in quantity} +is applicable to these copies of the Document, then if the Document is +less than one half of the entire aggregate, the Document's Cover Texts +may be placed on covers that bracket the Document within the +aggregate, or the electronic equivalent of covers if the Document is +in electronic form. Otherwise they must appear on printed covers that +bracket the whole aggregate. + +@subheading 8. Translations + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section +@emph{4. Modifications}. Replacing Invariant Sections with +translations requires special permission from their copyright holders, +but you may include translations of some or all Invariant Sections in +addition to the original versions of these Invariant Sections. You +may include a translation of this License, and all the license notices +in the Document, and any Warranty Disclaimers, provided that you also +include the original English version of this License and the original +versions of those notices and disclaimers. In case of a disagreement +between the translation and the original version of this License or a +notice or disclaimer, the original version will prevail. + +If a section in the Document is Entitled ``Acknowledgements'', +``Dedications'', or ``History'', the requirement (section @emph{4. +Modifications}) to Preserve its Title (section @emph{1. Applicability +and definitions}) will typically require changing the actual title. + +@subheading 9. Termination + +You may not copy, modify, sublicense, or distribute the Document +except as expressly provided for under this License. Any other +attempt to copy, modify, sublicense or distribute the Document is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +@subheading Future Revisions of this License + +The Free Software Foundation may publish new, revised versions of the +GNU Free Documentation 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. See +@url{http://www.gnu.org/copyleft/}. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. + +@subheading How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@verbatim + Copyright (C) YEAR YOUR NAME. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.2 or any later version published by the Free Software + Foundation; with no Invariant Sections, no Front-Cover Texts, + and no Back-Cover Texts. A copy of the license is included in + the section entitled ``GNU Free Documentation License''. +@end verbatim + +If you have Invariant Sections, Front-Cover Texts and Back-Cover +Texts, replace the ``with...Texts''. line with this: + +@verbatim + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts + being LIST. +@end verbatim + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, to +permit their use in free software. diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/GPL.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/GPL.texinfo new file mode 100755 index 0000000..3349125 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/GPL.texinfo @@ -0,0 +1,376 @@ +Version 2, June 1991 + +@verbatim +Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA +@end verbatim + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +@subheading Preamble + +The licenses for most software are designed to take away your freedom +to share and change it. By contrast, the GNU General Public License +is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, +we want its recipients to know that what they have is not the +original, so that any problems introduced by others will not reflect +on the original authors' reputations. + +Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at +all. + +The precise terms and conditions for copying, distribution and +modification follow. + +@subheading TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +@subsubheading Section 0 + +This License applies to any program or other work which contains a +notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The ``Program'', +below, refers to any such program or work, and a ``work based on the +Program'' means either the Program or any derivative work under +copyright law: that is to say, a work containing the Program or a +portion of it, either verbatim or with modifications and/or translated +into another language. (Hereinafter, translation is included without +limitation in the term ``modification''.) Each licensee is addressed +as ``you''. + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + +@subsubheading Section 1 + +You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +@subsubheading Section 2 + +You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +a) You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any part +thereof, to be licensed as a whole at no charge to all third parties +under the terms of this License. + +c) If the modified program normally reads commands interactively when +run, you must cause it, when started running for such interactive use +in the most ordinary way, to print or display an announcement +including an appropriate copyright notice and a notice that there is +no warranty (or else, saying that you provide a warranty) and that +users may redistribute the program under these conditions, and telling +the user how to view a copy of this License. (Exception: if the +Program itself is interactive but does not normally print such an +announcement, your work based on the Program is not required to print +an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +@subsubheading Section 3 + +You may copy and distribute the Program (or a work based on it, under +Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections 1 +and 2 above on a medium customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three years, +to give any third party, for a charge no more than your cost of +physically performing source distribution, a complete machine-readable +copy of the corresponding source code, to be distributed under the +terms of Sections 1 and 2 above on a medium customarily used for +software interchange; or, + +c) Accompany it with the information you received as to the offer to +distribute corresponding source code. (This alternative is allowed +only for noncommercial distribution and only if you received the +program in object code or executable form with such an offer, in +accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +@subsubheading Section 4 + +You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +@subsubheading Section 5 + +You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +@subsubheading Section 6 + +Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +@subsubheading Section 7 + +If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +@subsubheading Section 8 + +If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original +copyright holder who places the Program under this License may add an +explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +@subsubheading Section 9 + +The Free Software Foundation may publish revised and/or new versions +of the 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 Program +specifies a version number of this License which applies to it and ``any +later version'', you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + +@subsubheading Section 10 + +If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the +author to ask for permission. For software which is copyrighted by +the Free Software Foundation, write to the Free Software Foundation; +we sometimes make exceptions for this. Our decision will be guided by +the two goals of preserving the free status of all derivatives of our +free software and of promoting the sharing and reuse of software +generally. + +@subsubheading NO WARRANTY + +BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT +WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER +PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, +EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +@subsubheading Section 12 + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +@strong{END OF TERMS AND CONDITIONS} + +@subheading How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the ``copyright'' line and a pointer to where the full notice is +found. + +@verbatim + + Copyright (C) 19yy + + 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +@end verbatim + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + +@verbatim + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. +@end verbatim + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a ``copyright disclaimer'' for the program, if +necessary. Here is a sample; alter the names: + +@verbatim + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice +@end verbatim + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/chapter-menu.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/chapter-menu.texinfo new file mode 100755 index 0000000..b8240ba --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/chapter-menu.texinfo @@ -0,0 +1,4 @@ +@menu +* GNU General Public License:: +* GNU Free Documentation License:: +@end menu diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/chapter-nodes.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/chapter-nodes.texinfo new file mode 100755 index 0000000..e9c53f2 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/chapter-nodes.texinfo @@ -0,0 +1,9 @@ +@node GNU General Public License +@section GNU General Public License +@cindex GNU General Public License +@include branches/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/GPL.texinfo + +@node GNU Free Documentation License +@section GNU Free Documentation License +@cindex GNU Free Documentation License +@include branches/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/GFDL.texinfo diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/chapter.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/chapter.texinfo new file mode 100755 index 0000000..e5ffcbd --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/Licenses/chapter.texinfo @@ -0,0 +1,5 @@ +@node Licenses +@appendix Licenses +@cindex Licenses +@include Licenses/chapter-menu.texinfo +@include Licenses/chapter-nodes.texinfo diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-index.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-index.texinfo new file mode 100755 index 0000000..b197b13 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-index.texinfo @@ -0,0 +1,8 @@ +@node Index +@unnumbered Index +@syncodeindex fn cp +@syncodeindex vr cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex tp cp +@printindex cp diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-init.pl b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-init.pl new file mode 100755 index 0000000..c6eff54 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-init.pl @@ -0,0 +1,7 @@ +# This file extends the `../manual-init.pl' initialization file to +# provide English specific initializations for `texi2html-1.76-4.fc6'. +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +return 1; diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-menu.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-menu.texinfo new file mode 100644 index 0000000..0afc9ff --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-menu.texinfo @@ -0,0 +1,4 @@ +@menu +* Licenses:: +* Index:: +@end menu diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-nodes.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-nodes.texinfo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual-nodes.texinfo diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual.conf b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual.conf new file mode 100755 index 0000000..061f17f --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual.conf @@ -0,0 +1,36 @@ +# This file controls the manual configuration. This file is divided +# in configuration sections (e.g., `main' and `templates') which, in +# turn, are organized in the form `variable = value'. +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +[main] + +# Specify documentation backend used by documentation manual. This is +# the format used to write documentation manual source files. +manual_backend = "texinfo" + +# Specify title style used by sections inside the manual. Possible +# values to this option are `cap-each-word' to capitalize each word in +# the section title, `cap-first-word' to capitalize the first word in +# the section title only and `directory' to transform each word in the +# section title into a directory path. From all these options, +# `cap-each-word' is the one used as default. +manual_section_style = "cap-each-word" + +# Specify the order used by sections inside the manual. By default new +# sections added to the manual are put on the end to follow the +# section `created' order. Other possible values to this option are +# `ordered' and `reversed' to sort the list of sections alphabetically +# from A-Z and Z-A, respectively. +manual_section_order = "created" + +[templates] + +# Specify relation between template files and section definition files +# inside the manual. Template definition is set on the left side using +# relative path. The section main definition file is described on the +# right using a regular expression. The first match wins. +Chapters/section-functions.texinfo = "^.+-functions-[[:alnum:]]+\.texinfo$" +Chapters/section.texinfo = "^.+\.texinfo$" diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual.sed b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual.sed new file mode 100755 index 0000000..474a78f --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual.sed @@ -0,0 +1,40 @@ +#!/bin/sed +# +# repository.sed -- This file provide English transformations for +# texi2html outupt, based on The CentOS Project CSS definitions. +# +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +# Quotations. +s!

Note!

Info

Note

!g + +s!

Warning!

Warning

Warning

!g + +s!

Important!

Important

Important

!g + +s!

Tip!

Tip

Tip

!g + +s!

Caution!

Caution

Caution

!g + +s!

Convention!

Convention

Convention

!g + +s!

Redirection!

Redirection

Redirection

!g diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual.texinfo new file mode 100644 index 0000000..4565623 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/en_US/manual.texinfo @@ -0,0 +1,74 @@ +\input texinfo @c -*-texinfo-*- +@c -- Header -------------------------------------------------- + +@setfilename =MANUAL_NAME=.info +@settitle =MANUAL_TITLE= +@documentlanguage =LOCALE_LL= +@afourpaper +@finalout + +@c -- Variables ----------------------------------------------- + +@set TCENTOS The Community Enterprise Operating System +@set TCPROJ @url{http://www.centos.org/, The CentOS Project} +@set TCWIKI @url{http://wiki.centos.org/, The CentOS Wiki} +@set TCMLISTS @url{http://lists.centos.org/, The CentOS Mailing Lists} +@set TCBUGS @url{http://bugs.centos.org/, The CentOS Bugs} +@set TCMIRRORS @url{http://mirrors.centos.org/, The CentOS Mirrors} +@set TCPLANET @url{http://planet.centos.org/, The CentOS Planet} +@set TCFORUMS @url{http://forums.centos.org/, The CentOS Forums} +@set TCINFOML @email{centos-info@@centos.org, The CentOS Information Mailing List} +@set TCDEVSML @email{centos-devel@@centos.org, The CentOS Developers Mailing List} +@set TCDOCSML @email{centos-docs@@centos.org, The CentOS Documentation Mailing List} +@set TCARTWML @email{centos-artwork@@centos.org, The CentOS Artwork Mailing List} +@set TCL10NML @email{centos-l10n@@centos.org, The CentOS Localization Mailing List} +@set TCAR @url{https://projects.centos.org/svn/artwork/, The CentOS Artwork Repository} +@set TCAS @url{https://projects.centos.org/trac/artwork/, The CentOS Artwork SIG} + +@c -- Summary description and copyright ----------------------- + +@copying +=MANUAL_ABSTRACT= + +Copyright @copyright{} =COPYRIGHT_YEAR_LIST= =COPYRIGHT_HOLDER= + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation; with no +Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A +copy of the license is included in the section entitled @ref{GNU Free +Documentation License}. +@end copying + +@c -- Titlepage, contents, copyright --------------------------- + +@titlepage +@title =MANUAL_TITLE= +@subtitle =MANUAL_SUBTITLE= +@author =COPYRIGHT_HOLDER= +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage +@contents + +@c -- `Top' node and master menu ------------------------------- + +@ifnottex +@node Top +@top =MANUAL_TITLE= +@insertcopying +@end ifnottex + +@include =MANUAL_NAME=-menu.texinfo + +@c -- The body of the document -------------------------------- + +@include =MANUAL_NAME=-nodes.texinfo + +@c -- The end of the document --------------------------------- + +@include Licenses/chapter.texinfo +@include =MANUAL_NAME=-index.texinfo + +@bye diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/GFDL.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/GFDL.texinfo new file mode 100755 index 0000000..8f789ec --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/GFDL.texinfo @@ -0,0 +1,372 @@ +@subheading Preámbulo + +El propósito de esta Licencia es permitir que un manual, libro de +texto, u otro documento escrito sea «libre» en el sentido de libertad: +asegurar a todo el mundo la libertad efectiva de copiarlo y +redistribuirlo, con o sin modificaciones, de manera comercial o no. En +segundo término, esta Licencia proporciona al autor y al editor una +manera de obtener reconocimiento por su trabajo, sin que se le +considere responsable de las modificaciones realizadas por otros. + +Esta Licencia es de tipo «copyleft», lo que significa que los trabajos +derivados del documento deben a su vez ser libres en el mismo sentido. +Complementa la Licencia Pública General de GNU, que es una licencia +tipo copyleft diseñada para el software libre. + +Hemos diseñado esta Licencia para usarla en manuales de software +libre, ya que el software libre necesita documentación libre: Un +programa libre debe venir con los manuales que ofrezcan la mismas +libertades que da el software. Pero esta licencia no se limita a +manuales de software; puede ser usada para cualquier trabajo textual, +sin tener en cuenta su temática o si se publica como libro impreso. +Recomendamos esta licencia principalmente para trabajos cuyo fin sea +instructivo o de referencia. + +@subheading 1. Aplicación y definiciones + +Esta Licencia se aplica a cualquier manual u otro trabajo que contenga +un aviso colocado por el poseedor del copyright diciendo que puede +distribuirse bajo los términos de esta Licencia. El «Documento», +abajo, se refiere a cualquier manual o trabajo. Cualquier miembro del +público es un licenciatario,y será referido como «Usted». + +Una «Versión Modificada» del Documento significa cualquier trabajo que +contenga el Documento o una porción del mismo, ya sea una copia +literal o con modificaciones y/o traducciones a otro idioma. + +Una «Sección Secundaria» es un apéndice con título o una sección +preliminar del Documento que trata exclusivamente de la relación entre +los autores o editores y el tema general delDocumento que trata +exclusivamente con la relación entre los editores o autores del +Documento con el asunto general del Documento (o asuntos relacionados) +y no contiene nada que pueda considerarse dentro del tema principal. +(Por ejemplo, si el Documento es en parte un libro de texto de +matemáticas, una Sección Secundaria no explicará nada de matemáticas.) +La relación puede ser una conexión histórica con el asunto o temas +relacionados, o una opinión legal, comercial, filosófica, ética o +política acerca de ellos. + +Las «Secciones Invariantes» son ciertas Secciones Secundarias cuyos +títulos son designados como Secciones Invariantes en la nota que +indica que el Documento se publica bajo esta Licencia. + +Los «Textos de Cubierta» son ciertos pasajes cortos de texto que se +listan como Textos de Cubierta Delantera o Textos de Cubierta Trasera +en la nota que indica que el Documento se publica bajo esta Licencia. + +Una copia «Transparente» del Documento, significa una copia para +lectura en máquina, representada en un formato cuya especificación +está disponible al público en general, cuyo contenido puede ser visto +y editados directamente con editores de texto genéricos o (para +imágenes compuestas por píxeles) con programas genéricos de +manipulación de imágenes o (para dibujos) con algún editor de dibujos +ampliamente disponible, y que sea adecuado como entrada para +formateadores de texto o para su traducción automática a formatos +adecuados para formateadores de texto. Una copia hecha en un formato +definido como Transparente, pero cuyo marcaje o ausencia de él haya +sido diseñado para impedir o dificultar modificaciones posteriores por +parte de los lectores no es Transparente. Una copia que no es +«Transparente» se denomina «Opaca». + +Como ejemplos de formatos adecuados para copias Transparentes están +ASCII puro sin marcaje, formato de entrada de Texinfo, formato de +entrada de LaTeX, SGML o XML usando una DTD disponible públicamente, y +HTML, PostScript o PDF simples, que sigan los estándares y diseños +para que los modifiquen personas.Los formatos Opacos incluyen formatos +propietarios que pueden ser leídos y editados únicamente en +procesadores de textos propietarios, SGML o XML para los cuáles las +DTD y/o herramientas de procesamiento no estén ampliamente +disponibles, y HTML, PostScript o PDF generados por algunos +procesadores de textos sólo como salida. + +La «Portada» significa, en un libro impreso, la página de título, más +las páginas siguientes que sean necesarias para mantener legiblemente +el material que esta Licencia requiere en la portada. Para trabajos en +formatos que no tienen página de portada como tal, «Portada»significa +el texto cercano a la aparición más prominente del título del +trabajo,precediendo el comienzo del cuerpo del texto. + +@subheading 2. Copia literal + +Usted puede copiar y distribuir el Documento en cualquier medio, sea +en forma comercial o no, siempre y cuando proporcione esta Licencia, +las notas de copyright y la nota que indica que esta Licencia se +aplica al Documento reproduciéndola en todas las copias y que usted no +añada ninguna otra condición a las expuestas en esta Licencia. Usted +no puede usar medidas técnicas para obstruir o controlar la lectura o +copia posterior de las copias que usted haga o distribuya. Sin +embargo, usted puede aceptar compensación a cambio de las copias. Si +distribuye un número suficientemente grande de copias también deberá +seguir las condiciones de la sección 3. + +Usted también puede prestar copias, bajo las mismas condiciones +establecidas anteriormente, y puede exhibir copias públicamente. + +@subheading 3. Copiando en cantidad + +Si publica copias impresas del Documento que sobrepasen las 100, y la +nota de licencia del Documento exige Textos de Cubierta, debe +incluirlas copias con cubiertas que lleven en forma clara y legible +todos esos Textos de Cubierta: Textos de Cubierta Delantera en la +cubierta delantera y Textos de Cubierta Trasera en la cubierta +trasera. Ambas cubiertas deben identificarlo a Usted clara y +legiblemente como editor de tales copias. La cubierta debe mostrar el +título completo con todas las palabras igualmente prominentes y +visibles. Además puede añadir otro material en las cubiertas. Las +copias con cambios limitados a las cubiertas, siempre que conserven el +título del Documento y satisfagan estas condiciones, pueden +considerarse como copias literales en todos los aspectos. + +Si los textos requeridos para la cubierta son muy voluminosos para que +ajusten legiblemente, debe colocar los primeros (tantos como sea +razonable colocar) en la verdadera cubierta y situar el resto en +páginas adyacentes. + +Si Usted publica o distribuye copias Opacas del Documento cuya +cantidad exceda las 100, debe incluir una copia Transparente, que +pueda ser leída por una máquina, con cada copia Opaca, o bien mostrar, +en cada copia Opaca, una dirección de red donde cualquier usuario de +la misma tenga acceso por medio de protocolos públicos y +estandarizados a una copia Transparente del Documento completa, sin +material adicional. Si usted hace uso de la última opción, deberá +tomar las medidas necesarias, cuando comience la distribución de las +copias Opacas en cantidad, para asegurar que esta copia Transparente +permanecerá accesible en el sitio establecido por lo menos un año +después de la última vez que distribuya una copia Opaca de esa edición +al público (directamente o a través de sus agentes o distribuidores). + +Se solicita, aunque no es requisito, que se ponga en contacto con los +autores del Documento antes de redistribuir gran número de copias, +para darles la oportunidad de que le proporcionen una versión +actualizada del Documento. + +@subheading 4. Modificaciones + +Puede copiar y distribuir una Versión Modificada del Documento bajo +las condiciones de las secciones 2 y 3 anteriores, siempre que Usted +libere la Versión Modificada bajo esta misma Licencia, con la Versión +Modificada haciendo el rol del Documento, por lo tanto dando Licencia +de distribución y modificación de la Versión Modificada a quienquiera +posea una copia de la misma. Además, debe hacer lo siguiente en la +Versión Modificada: + +A. Usar en la Portada (y en las cubiertas, si hay alguna) un título +distinto al del Documento y de sus versiones anteriores (que deberían, +si hay alguna, estar listadas en la sección de Historia del +Documento). Puede usar el mismo título de versiones anteriores al +original siempre y cuando quien las publicó originalmente otorgue +permiso. + +B. Listar en la Portada, como autores, una o más personas o entidades +responsables de la autoría de las modificaciones de la Versión +Modificada, junto con por lo menos cinco de los autores principales +del Documento (todos sus autores principales, si hay menos de cinco), +a menos que le eximan de tal requisito. + +C. Mostrar en la Portada como editor el nombre del editor de la +Versión Modificada + +D. Conservar todas las notas de copyright del Documento. + +E. Añadir una nota de copyright apropiada a sus modificaciones, +adyacente a las otras notas de copyright. + +F. Incluir, inmediatamente después de los avisos de copyright, una +nota de licencia dando el permiso público para usar la Versión +Modificada bajo los términos de esta Licencia, de la forma mostrada en +el Adenda de más abajo. + +G. Incluir, inmediatamente después de ese aviso de licencia, la lista +completa de Secciones invariantes y de los Textos de Cubierta que sean +requeridos en el aviso de Licencia del Documento original. + +H. Incluir una copia sin modificación de esta Licencia. + +I. Conservar la sección titulada «Historia», conservar su Título y +añadirle un elemento que declare al menos el título, el año, los +nuevos autores y el editor de la Versión Modificada, tal como figuran +en la Portada. Si no hay una sección titulada «Historia» en el +Documento, crear una estableciendo el título, el año, los autores y el +editor del Documento, tal como figuran en su Portada, añadiendo además +un elemento describiendo la Versión Modificada, como se estableció en +la sentencia anterior. + +J. Conservar la dirección en red, si la hay, dada en el Documento para +el acceso público a una copia Transparente del mismo, así como las +otras direcciones de red dadas en el Documento para versiones +anteriores en las que estuviese basado. Pueden ubicarse en la sección +«Historia». Se puede omitir la ubicación en red de un trabajo que haya +sido publicado por lo menos cuatro años antes que el Documento mismo, +o si el editor original de dicha versión da permiso. + +K. En cualquier sección titulada «Agradecimientos» o «Dedicatorias», +conservar el título de la sección y conservar en ella toda la +sustancia y el tono de los agradecimientos y/o dedicatorias incluidas +por cada contribuyente. + +L. Conservar todas las Secciones Invariantes del Documento, sin +alterar su texto ni sus títulos. Los números de sección o equivalentes +no se consideran parte de los títulos de la sección. + +M. Borrar cualquier sección titulada «Aprobaciones». Tales secciones +no pueden estar incluidas en las Versiones Modificadas. + +N. No cambiar el título de ninguna sección existente a «Aprobaciones» +ni a uno que entre en conflicto con el de alguna Sección Invariante. + +Si la Versión Modificada incluye secciones o apéndices nuevos que +cualifiquen como Secciones Secundarias y no contienen ningún material +copiado del Documento, puede opcionalmente designar algunas o todas +esas secciones como invariantes. Para hacerlo, añada sus títulos a la +lista de Secciones Invariantes en el aviso de licencia de la Versión +Modificada. Tales títulos deben ser distintos de cualquier otro título +de sección. + +Puede añadir una sección titulada «Aprobaciones», siempre que contenga +únicamente aprobaciones de su Versión Modificada por otras fuentes +--por ejemplo, observaciones de compañeros o que el texto ha sido +aprobado por una organización como definición oficial de un estándar. + +Puede añadir un pasaje de hasta cinco palabras como Texto de Cubierta +Delantera y un pasaje de hasta 25 palabras como Texto de Cubierta +Trasera al final de la lista de Texto de Cubierta en la Versión +Modificada. Una entidad sólo puede añadir (o hacer que se añada) un +pasaje al Texto de Cubierta Delantera y uno al de Cubierta Trasera. Si +el Documento ya incluye un textos de cubiertas añadidos previamente +por usted o por acuerdo previo con la entidad que usted representa, +usted no puede añadir otro; pero puede reemplazar el anterior, con +permiso explícito del editor anterior que agregó el texto anterior. + +Con esta Licencia ni los autores ni los editores del Documento dan +permiso para usar sus nombres para publicidad ni para asegurar o +implicar aprobación de cualquier Versión Modificada. + +@subheading 5. Combinación de documentos + +Usted puede combinar el Documento con otros documentos liberados bajo +esta Licencia, bajo los términos definidos en la sección section 4 más +arriba para versiones modificadas, siempre que incluya en la +combinación todas las Secciones Invariantes de todos los documentos +originales, sin modificaciones, y las liste todas como Secciones +Invariantes de su trabajo combinado en su aviso de licencia. + +El trabajo combinado necesita contener solamente una copia de esta +Licencia, y múltiples Secciones Invariantes idénticas pueden +reemplazarse por una sola copia. Si hay múltiples Secciones +Invariantes con el mismo nombre pero con contenidos diferentes, haga +el título de cada una de estas secciones único añadiéndolo al final de +este, entre paréntesis, el nombre del autor o de quien editó +originalmente esa sección, si es conocido, o si no, un número único. +Haga el mismo ajuste a los títulos de sección en la lista de Secciones +Invariantes en la nota de licencia del trabajo combinado. + +En la combinación, debe combinar cualquier sección titulada «Historia» +de los distintos documentos originales, formando una sección titulada +«Historia»; de la misma forma, combine cualquier sección titulada +«Reconocimientos» y cualquier sección titulada «Dedicatorias». Debe +borrar todas las secciones tituladas «Aprobaciones». + +@subheading 6. Colecciones de documentos + +Puede hacer una colección que conste del Documento y de otros +documentos publicados bajo esta Licencia, y reemplazar las copias +individuales de esta Licencia en todos los documentos por una sola +copia que esté incluida en la colección, siempre que siga las reglas +de esta Licencia para cada copia literal de cada uno de los documentos +en cualquiera de los demás aspectos. + +Puede extraer un solo documento de una de tales colecciones y +distribuirlo individualmente bajo esta Licencia, siempre que inserte +una copia de esta Licencia en el documento extraído, y siga esta +Licencia en todos los demás aspectos relativos a la copia literal de +dicho documento. + +@subheading 7. Agregación con trabajos independientes + +Una recopilación que conste del Documento o sus derivados y de otros +documentos o trabajos separados e independientes, en cualquier soporte +de almacenamiento o distribución, no cuenta como un todo como una +Versión Modificada del Documento, siempre que no se reclame ningún +derecho de copyright por la compilación. Dicha compilación se denomina +un «agregado», y esta Licencia no se aplica a otros trabajos +autocontenidos incluidos con el Documento. teniendo en cuenta que son +compilados, si no son los mismos trabajos derivados del Documento. Si +el requisito de Texto de Cubierta de la sección 3 es aplicable a estas +copias del Documento, entonces si el Documento es menor que un cuarto +del agregado completo, los Textos de Cubierta del Documento pueden +colocarse en cubiertas que enmarquen solamente el Documento dentro del +agregado. En caso contrario deben aparecer en cubiertas impresas +enmarcando todo el agregado. + +@subheading 8. Traducción + +La Traducción se considera como un tipo de modificación, por lo que +usted puede distribuir traducciones del Documento bajo los términos de +la sección 4. El reemplazo las Secciones Invariantes por traducciones +requiere permiso especial de los poseedores del copyright, pero usted +puede incluir traducciones de algunas o todas las Secciones +Invariantes junto con las versiones originales de las mismas. Puede +incluir una traducción de esta Licencia, siempre que incluya también +la versión original en inglés de esta Licencia. En caso de desacuerdo +entre la traducción y la versión original en inglés de esta Licencia, +la versión original en Inglés prevalecerá. + +@subheading 9. Terminación + +Usted no puede copiar, modificar, sublicenciar o distribuir el +Documento salvo por lo permitido expresamente por esta Licencia. +Cualquier otro intento de copia, modificación, sublicenciamiento o +distribución del Documento es nulo, y dará por terminados +automáticamente sus derechos bajo esa Licencia. Sin embargo, los +terceros que hayan recibido copias, o derechos, de usted bajo esta +Licencia no verán terminadas sus licencias, siempre que permanezcan en +total conformidad con ella. + +@subheading Revisiones futuras de esta licencia + +La Free Software Foundation puede publicar versiones nuevas y +revisadas de la Licencia de Documentación Libre GNU de vez en cuando. +Dichas versiones nuevas serán similares en espíritu a la presente +versión, pero pueden diferir en detalles para solucionar nuevos +problemas o preocupaciones. Vea @url{http://www.gnu.org/copyleft/}. + +Cada versión de la Licencia tiene un número de versión que la +distingue. Si el Documento especifica que se aplica una versión +numerada en particular de esta licencia o «cualquier versión +posterior», usted tiene la opción de seguir los términos y condiciones +de la versión especificada o cualquiera posterior que haya sido +publicada (no como borrador) por la Free Software Foundation. Si el +Documento no especifica un número de versión de esta Licencia, puede +escoger cualquier versión que haya sido publicada (no como borrador) +por la Free Software Foundation. + +@subheading Adenda + +Para usar esta licencia en un documento que usted haya escrito, +incluya una copia de la Licencia en el documento y ponga el siguiente +copyright y notificación de licencia justo después de la página de +título: + +@example +Copyright © AÑO SU NOMBRE. + +Se otorga permiso para copiar, distribuir y/o modificar este documento +bajo los términos de la Licencia de Documentación Libre de GNU, +Versión 1.1 o cualquier otra versión posterior publicada por la +Free Software Foundation; con las Secciones Invariantes siendo su +LISTE SUS TÍTULOS, con Textos de Cubierta Delantera siendo LISTA, y +con los Textos de Cubierta Trasera siendo LISTA. Una copia de la +licencia está incluida en la sección titulada «GNU Free +Documentation License». +@end example + +Si no tiene Secciones Invariantes, escriba «sin Secciones Invariantes» +en vez de decir cuáles son invariantes. Si no tiene Textos de Cubierta +Frontal, escriba «sin Textos de Cubierta Frontal»; de la misma manera +para Textos de Cubierta Trasera. + +Si su documento contiene ejemplos de código de programa no triviales, +recomendamos liberar estos ejemplos en paralelo bajo la licencia de +software libre que usted elija, como la Licencia Pública General de +GNU (@pxref{GNU General Public License}), para permitir su uso en +software libre. diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/GPL.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/GPL.texinfo new file mode 100755 index 0000000..79680fe --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/GPL.texinfo @@ -0,0 +1,329 @@ +@subheading Preámbulo + +Las licencias que cubren la mayor parte del software están diseñadas +para quitarle a usted la libertad de compartirlo y modificarlo. Por el +contrario, la Licencia Pública General de GNU pretende garantizarle la +libertad de compartir y modificar software libre, para asegurar que el +software es libre para todos sus usuarios. Esta Licencia Pública +General se aplica a la mayor parte del software del la Free Software +Foundation y a cualquier otro programa si sus autores se comprometen a +utilizarla. (Existe otro software de la Free Software Foundation que +está cubierto por la Licencia Pública General de GNU para +Bibliotecas). Si quiere, también puede aplicarla a sus propios +programas. + +Cuando hablamos de software libre, estamos refiriéndonos a libertad, +no a precio. Nuestras Licencias Públicas Generales están diseñadas +para asegurarnos de que tenga la libertad de distribuir copias de +software libre (y cobrar por ese servicio si quiere), de que reciba el +código fuente o que pueda conseguirlo si lo quiere, de que pueda +modificar el software o usar fragmentos de él en programas nuevos +libres, y de que sepa que puede hacer todas estas cosas. + +Para proteger sus derechos necesitamos algunas restricciones que +prohíban a cualquiera negarle a usted estos derechos o pedirle que +renuncie a ellos. Estas restricciones se traducen en ciertas +obligaciones que le afectan si distribuye copias del software, o si lo +modifica. + +Por ejemplo, si distribuye copias de uno de estos programas, sea +gratuitamente, o a cambio de una contraprestación, debe dar a los +receptores todos los derechos que tiene. Debe asegurarse de que ellos +también reciben, o pueden conseguir, el código fuente. Y debe +mostrarles estas condiciones de forma que conozcan sus derechos. + +Protegemos sus derechos con la combinación de dos medidas: + +@itemize +@item Derechos de copia del software (copyright), y +@item Le ofrecemos esta licencia, que le da permiso legal para copiar, +distribuir y/o modificar el software. +@end itemize + +También, para la protección de cada autor y la nuestra propia, +queremos asegurarnos de que todo el mundo comprende que no se +proporciona ninguna garantía para este software libre. Si el software +se modifica por cualquiera y éste a su vez lo distribuye, queremos que +sus receptores sepan que lo que tienen no es el original, de forma que +cualquier problema introducido por otros no afecte a la reputación de +los autores originales. + +Finalmente, cualquier programa libre está constantemente amenazado por +patentes sobre el software. Queremos evitar el peligro de que los +redistribuidores de un programa libre obtengan patentes por su cuenta, +convirtiendo de facto el programa en propietario. Para evitar esto, +hemos dejado claro que cualquier patente debe ser pedida para el uso +libre de cualquiera, o no ser pedida. + +Los términos precisos y las condiciones para la copia, distribución y +modificación se exponen a continuación. + +@subheading TÉRMINOS Y CONDICIONES PARA LA COPIA, DISTRIBUCIÓN Y MODIFICACIÓN + +@subsubheading Sección 0 + +Esta Licencia se aplica a cualquier programa u otro tipo de obra que +contenga una notificación colocada por el propietario del copyright +diciendo que puede distribuirse bajo los términos de esta Licencia +Pública General. El «Programa», en adelante, se referirá a cualquier +programa u obra, y «obra basada en el Programa» se referirá bien al +Programa o a cualquier trabajo derivado de él según la ley de derechos +de autor (copyright): Esto es, una obra o trabajo que contenga el +programa o una porción de él, bien en forma literal o con +modificaciones y/o traducido en otro lenguaje. Aquí y después, la +traducción está incluida sin limitación en el término «modificación». +Cada concesionario (licenciatario) será denominado «usted». + +Cualquier otra actividad que no sea la copia, distribución o +modificación no está cubierta por esta Licencia, está fuera de su +ámbito. El acto de ejecutar el Programa no está restringido, y los +resultados del Programa están cubiertos únicamente si sus contenidos +constituyen un trabajo basado en el Programa, independientemente de +haberlo producido mediante la ejecución del programa. El que esto se +cumpla, depende de lo que haga el programa. + +@subsubheading Sección 1 + +Usted puede copiar y distribuir copias literales del código fuente del +Programa, según lo has recibido, en cualquier medio, supuesto que de +forma adecuada y bien visible publique en cada copia un anuncio de +copyright adecuado y un repudio de garantía, mantenga intactos todos +los anuncios que se refieran a esta Licencia y a la ausencia de +garantía, y proporcione a cualquier otro receptor del programa una +copia de esta Licencia junto con el Programa. + +Puede cobrar un precio por el acto físico de transferir una copia, y +puede, según su libre albedrío, ofrecer garantía a cambio de unos +honorarios. + +@subsubheading Sección 2 + +Puede modificar su copia o copias del Programa o de cualquier porción +de él, formando de esta manera un trabajo basado en el Programa, y +copiar y distribuir esa modificación o trabajo bajo los términos de la +Sección 1 anterior, probado que además usted cumpla con todas las +siguientes condiciones: + +@enumerate +@item Debe hacer que los ficheros modificados lleven anuncios +prominentes indicando que los ha cambiado y la fecha de cualquier +cambio. + +@item Debe hacer que cualquier trabajo que distribuya o publique y que +en todo o en parte contenga o sea derivado del Programa o de cualquier +parte de él sea licenciada como un todo, sin carga alguna, a todas las +terceras partes y bajo los términos de esta Licencia. + +@item If the modified program normally reads commands interactively +when run, you must cause it, when started running for such interactive +use in the most ordinary way, to print or display an announcement +including an appropriate copyright notice and a notice that there is +no warranty (or else, saying that you provide a warranty) and that +users may redistribute the program under these conditions, and telling +the user how to view a copy of this License. + +Excepción: Si el propio Programa es interactivo pero normalmente no +muestra ese anuncio, no se requiere que su trabajo basado en el +Programa muestre ningún anuncio. + +@end enumerate + +Estos requisitos se aplican al trabajo modificado como un todo. Si +partes identificables de ese trabajo no son derivadas del Programa, y +pueden, razonablemente, ser consideradas trabajos independientes y +separados por ellos mismos, entonces esta Licencia y sus términos no +se aplican a esas partes cuando sean distribuidas como trabajos +separados. Pero cuando distribuya esas mismas secciones como partes de +un todo que es un trabajo basado en el Programa, la distribución del +todo debe ser según los términos de esta licencia, cuyos permisos para +otros licenciatarios se extienden al todo completo, y por lo tanto a +todas y cada una de sus partes, con independencia de quién la +escribió. + +Por lo tanto, no es la intención de este apartado reclamar derechos o +desafiar sus derechos sobre trabajos escritos totalmente por usted +mismo. El intento es ejercer el derecho a controlar la distribución de +trabajos derivados o colectivos basados en el Programa. + +Además, el simple hecho de reunir un trabajo no basado en el Programa +con el Programa (o con un trabajo basado en el Programa) en un volumen +de almacenamiento o en un medio de distribución no hace que dicho +trabajo entre dentro del ámbito cubierto por esta Licencia. + +@subsubheading Sección 3 + +Puede copiar y distribuir el Programa (o un trabajo basado en él, +según se especifica en la Sección 2, como código objeto o en formato +ejecutable según los términos de las Secciones 1 y 2 anteriores, +supuesto que además cumpla una de las siguientes condiciones: + +@enumerate + +@item Acompañarlo con el código fuente leíble completo +correspondiente, leíble por máquinas, que debe ser distribuido según +los términos las Secciones 1 y 2 mencionadas antes en un medio +habitualmente utilizado para el intercambio de software, o, + +@item Acompañarlo con una oferta por escrito, válida durante al menos +tres años, de proporcionar a cualquier tercera parte una copia +completa en formato electrónico del código fuente correspondiente, a +un coste no mayor que el de realizar físicamente la distribución del +fuente, que será distribuido bajo las condiciones descritas en los +apartados 1 y 2 anteriores, en un medio habitualmente utilizado para +el intercambio de programas, o + +@item Acompañarlo con la información que recibiste ofreciendo +distribuir el código fuente correspondiente. (Esta opción se permite +sólo para distribución no comercial y sólo si usted recibió el +programa como código objeto o en formato ejecutable con tal oferta, de +acuerdo con la Subsección b anterior). +@end enumerate + +Por código fuente de un trabajo se entiende la forma preferida del +trabajo cuando se le hacen modificaciones. Para un trabajo ejecutable, +se entiende por código fuente completo todo el código fuente para +todos los módulos que contiene, más cualquier fichero asociado de +definición de interfaces, más los guiones utilizados para controlar la +compilación e instalación del ejecutable. Como excepción especial el +código fuente distribuido no necesita incluir nada que sea distribuido +normalmente (bien como fuente, bien en forma binaria) con los +componentes principales (compilador, núcleo y similares) del sistema +operativo en el cual funciona el ejecutable, a no ser que el propio +componente acompañe al ejecutable. + +Si la distribución del ejecutable o del código objeto se hace mediante +la oferta acceso para copiarlo de un cierto lugar, entonces se +considera la oferta de acceso para copiar el código fuente del mismo +lugar como distribución del código fuente, incluso aunque terceras +partes no estén forzadas a copiar el fuente junto con el código +objeto. + +@subsubheading Sección 4 + +No puede copiar, modificar, sublicenciar o distribuir el Programa +excepto como prevé expresamente esta Licencia. Cualquier intento de +copiar, modificar sublicenciar o distribuir el Programa de otra forma +es inválida, y hará que cesen automáticamente los derechos que te +proporciona esta Licencia. En cualquier caso, las partes que hayan +recibido copias o derechos de usted bajo esta Licencia no cesarán en +sus derechos mientras esas partes continúen cumpliéndola. 5Sección 5 + +No está obligado a aceptar esta licencia, ya que no la ha firmado. Sin +embargo, no hay hada más que le proporcione permiso para modificar o +distribuir el Programa o sus trabajos derivados. Estas acciones están +prohibidas por la ley si no acepta esta Licencia. Por lo tanto, si +modifica o distribuye el Programa (o cualquier trabajo basado en el +Programa), está indicando que acepta esta Licencia para poder hacerlo, +y todos sus términos y condiciones para copiar, distribuir o modificar +el Programa o trabajos basados en él. 6Sección 6 + +Cada vez que redistribuya el Programa (o cualquier trabajo basado en +el Programa), el receptor recibe automáticamente una licencia del +licenciatario original para copiar, distribuir o modificar el +Programa, de forma sujeta a estos términos y condiciones. No puede +imponer al receptor ninguna restricción más sobre el ejercicio de los +derechos aquí garantizados. No es usted responsable de hacer cumplir +esta licencia por terceras partes. 7Sección 7 + +Si como consecuencia de una resolución judicial o de una alegación de +infracción de patente o por cualquier otra razón (no limitada a +asuntos relacionados con patentes) se le imponen condiciones (ya sea +por mandato judicial, por acuerdo o por cualquier otra causa) que +contradigan las condiciones de esta Licencia, ello no le exime de +cumplir las condiciones de esta Licencia. Si no puede realizar +distribuciones de forma que se satisfagan simultáneamente sus +obligaciones bajo esta licencia y cualquier otra obligación pertinente +entonces, como consecuencia, no puede distribuir el Programa de +ninguna forma. Por ejemplo, si una patente no permite la +redistribución libre de derechos de autor del Programa por parte de +todos aquellos que reciban copias directa o indirectamente a través de +usted, entonces la única forma en que podría satisfacer tanto esa +condición como esta Licencia sería evitar completamente la +distribución del Programa. + +Si cualquier porción de este apartado se considera inválida o +imposible de cumplir bajo cualquier circunstancia particular ha de +cumplirse el resto y la sección por entero ha de cumplirse en +cualquier otra circunstancia. + +No es el propósito de este apartado inducirle a infringir ninguna +reivindicación de patente ni de ningún otro derecho de propiedad o +impugnar la validez de ninguna de dichas reivindicaciones. Este +apartado tiene el único propósito de proteger la integridad del +sistema de distribución de software libre, que se realiza mediante +prácticas de licencia pública. Mucha gente ha hecho contribuciones +generosas a la gran variedad de software distribuido mediante ese +sistema con la confianza de que el sistema se aplicará +consistentemente. Será el autor/donante quien decida si quiere +distribuir software mediante cualquier otro sistema y una licencia no +puede imponer esa elección. + +Este apartado pretende dejar completamente claro lo que se cree que es +una consecuencia del resto de esta Licencia. + +@subsubheading Sección 8 + +Si la distribución y/o uso de el Programa está restringida en ciertos +países, bien por patentes o por interfaces bajo copyright, el tenedor +del copyright que coloca este Programa bajo esta Licencia puede añadir +una limitación explícita de distribución geográfica excluyendo esos +países, de forma que la distribución se permita sólo en o entre los +países no excluidos de esta manera. En ese caso, esta Licencia +incorporará la limitación como si estuviese escrita en el cuerpo de +esta Licencia. 9Sección 9 + +La Free Software Foundation puede publicar versiones revisadas y/o +nuevas de la Licencia Pública General de tiempo en tiempo. Dichas +nuevas versiones serán similares en espíritu a la presente versión, +pero pueden ser diferentes en detalles para considerar nuevos +problemas o situaciones. + +Cada versión recibe un número de versión que la distingue de otras. Si +el Programa especifica un número de versión de esta Licencia que se +aplica aplica a éste y a «cualquier versión posterior», usted tiene la +opción de seguir los términos y condiciones, bien de esa versión, bien +de cualquier versión posterior publicada por la Free Software +Foundation. Si el Programa no especifica un número de versión de esta +Licencia, usted puede escoger cualquier versión publicada por la Free +Software Foundation. + +@subsubheading Sección 10 + +Si quiere incorporar partes del Programa en otros programas libres +cuyas condiciones de distribución son diferentes, escribe al autor +para pedirle permiso. Si el software tiene copyright de la Free +Software Foundation, escribe a la Free Software Foundation: algunas +veces hacemos excepciones en estos casos. Nuestra decisión estará +guiada por el doble objetivo de de preservar la libertad de todos los +derivados de nuestro software libre y promover el que se comparta y +reutilice el software en general. + +@subsubheading AUSENCIA DE GARANTÍA + +Sección 11 + +DEBIDO A QUE EL PROGRAMA SE LICENCIA LIBRE DE CARGAS, NO SE OFRECE +NINGUNA GARANTÍA SOBRE EL PROGRAMA, EN TODA LA EXTENSIÓN PERMITIDA POR +LA LEGISLACIÓN APLICABLE. EXCEPTO CUANDO SE INDIQUE DE OTRA FORMA POR +ESCRITO, LOS PROPIETARIOS DEL COPYRIGHT Y/U OTRAS PARTES PROPORCIONAN +EL PROGRAMA «TAL CUAL», SIN GARANTÍA DE NINGUNA CLASE, BIEN EXPRESA O +IMPLÍCITA, CON INCLUSIÓN, PERO SIN LIMITACIÓN A LAS GARANTÍAS +MERCANTILES IMPLÍCITAS O A LA CONVENIENCIA PARA UN PROPÓSITO +PARTICULAR. CUALQUIER RIESGO REFERENTE A LA CALIDAD Y PRESTACIONES DEL +PROGRAMA ES ASUMIDO POR USTED. SI SE PROBASE QUE EL PROGRAMA ES +DEFECTUOSO, USTED ASUME EL COSTE DE CUALQUIER SERVICIO, REPARACIÓN O +CORRECCIÓN NECESARIO. + +@subsubheading Sección 12 + +EN NINGÚN CASO, SALVO QUE LO REQUIERA LA LEGISLACIÓN APLICABLE O HAYA +SIDO ACORDADO POR ESCRITO, NINGÚN TENEDOR DEL COPYRIGHT NI NINGUNA +OTRA PARTE QUE MODIFIQUE Y/O REDISTRIBUYA EL PROGRAMA SEGÚN SE PERMITE +EN ESTA LICENCIA SERÁ RESPONSABLE ANTE USTED POR DAÑOS, INCLUYENDO +CUALQUIER DAÑO GENERAL, ESPECIAL, INCIDENTAL O RESULTANTE PRODUCIDO +POR EL USO O LA IMPOSIBILIDAD DE USO DEL PROGRAMA (CON INCLUSIÓN, PERO +SIN LIMITACIÓN A LA PÉRDIDA DE DATOS O A LA GENERACIÓN INCORRECTA DE +DATOS O A PÉRDIDAS SUFRIDAS POR USTED O POR TERCERAS PARTES O A UN +FALLO DEL PROGRAMA AL FUNCIONAR EN COMBINACIÓN CON CUALQUIER OTRO +PROGRAMA), INCLUSO SI DICHO TENEDOR U OTRA PARTE HA SIDO ADVERTIDO DE +LA POSIBILIDAD DE DICHOS DAÑOS. diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/chapter-menu.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/chapter-menu.texinfo new file mode 100755 index 0000000..b8240ba --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/chapter-menu.texinfo @@ -0,0 +1,4 @@ +@menu +* GNU General Public License:: +* GNU Free Documentation License:: +@end menu diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/chapter-nodes.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/chapter-nodes.texinfo new file mode 100755 index 0000000..2c4fcfd --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/chapter-nodes.texinfo @@ -0,0 +1,9 @@ +@node GNU General Public License +@section Licencia Pública General de GNU +@cindex Licencia pública general GNU +@include branches/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/GPL.texinfo + +@node GNU Free Documentation License +@section Licencia de Documentación Libre de GNU +@cindex Licencia documentación libre GNU +@include branches/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/GFDL.texinfo diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/chapter.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/chapter.texinfo new file mode 100755 index 0000000..fed7e22 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/Licenses/chapter.texinfo @@ -0,0 +1,5 @@ +@node Licenses +@appendix Licencias +@cindex Licencias +@include Licenses/chapter-menu.texinfo +@include Licenses/chapter-nodes.texinfo diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-index.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-index.texinfo new file mode 100755 index 0000000..bed8139 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-index.texinfo @@ -0,0 +1,8 @@ +@node Index +@unnumbered Índice +@syncodeindex fn cp +@syncodeindex vr cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex tp cp +@printindex cp diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-init.pl b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-init.pl new file mode 100755 index 0000000..d8e2045 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-init.pl @@ -0,0 +1,119 @@ +# This file extends the '../manual-init.pl' initialization file to # provide Spanish translation messages for `texi2html-1.76-4.fc6'. +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +$LANGUAGES->{'es'} = { + ' The buttons in the navigation panels have the following meaning:' => 'Los botones en el panel de navegación tienen el significado siguiente:', + ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => 'donde el @strong{Ejemplo} asume que la posición actual es en @strong{Subsubsección Uno-Dos-Tres}', + ' Up ' => 'Arriba', + '%{acronym_like} (%{explanation})' => '', + '%{month}, %{day} %{year}' => '', + '%{name} of %{class}' => '%{name} de %{class}', + '%{name} on %{class}' => '%{name} en %{class}', + '%{node_file_href}' => '', + '%{node_file_href} @cite{%{book}}' => '', + '%{node_file_href} section `%{section}\' in @cite{%{book}}' => 'sección %{node_file_href} `%{section}\' en @cite{%{book}}', + '%{reference_name}' => '', + '%{style} %{number}' => '', + '%{style}: %{caption_first_line}' => '', + '%{style}: %{shortcaption_first_line}' => '', + '@b{%{quotation_arg}:} ' => '', + '@cite{%{book}}' => '', + 'About This Document' => 'Acerca de este documento', + 'April' => 'abril', + 'August' => 'agosto', + 'Button' => 'Botón', + 'Contents' => 'Contenidos', + 'Current Position' => 'Posición actual', + 'December' => 'diciembre', + 'February' => 'febrero', + 'Footnotes' => 'Pie de página', + 'From 1.2.3 go to' => 'Desde 1.2.3 va a', + 'Go to' => 'Ir a', + 'Index' => 'Índice', + 'Index Entry' => 'Entrada índice', + 'January' => 'enero', + 'July' => 'julio', + 'Jump to' => 'Saltar a', + 'June' => 'junio', + 'March' => 'marzo', + 'May' => 'mayo', + 'Menu:' => 'Menú:', + 'Name' => 'Nombre', + 'Next' => 'Siguiente', + 'November' => 'noviembre', + 'October' => 'octubre', + 'Overview' => 'Introducción', + 'Overview:' => 'Introducción:', + 'Prev' => 'Anterior', + 'Section' => 'Sección', + 'Section One' => 'Sección Uno', + 'See %{node_file_href}' => 'Véase %{node_file_href}', + 'See %{node_file_href} @cite{%{book}}' => 'Véase %{node_file_href} @cite{%{book}}', + 'See %{node_file_href} section `%{section}\' in @cite{%{book}}' => 'Véase la sección %{node_file_href} `%{section}\' en @cite{%{book}}', + 'See %{reference_name}' => 'Véase %{reference_name}', + 'See @cite{%{book}}' => 'Véase @cite{%{book}}', + 'See section %{reference_name}' => 'Véase la sección %{reference_name}', + 'See section `%{section}\' in @cite{%{book}}' => 'Véase la sección `%{section}\' en @cite{%{book}}', + 'September' => 'septiembre', + 'Short Table of Contents' => 'Resumen del Contenido', + 'Subsection One-Four' => 'Subsección Uno-Cuatro', + 'Subsection One-One' => 'Subsección Uno-Uno', + 'Subsection One-Three' => 'Subsección Uno-Tres', + 'Subsection One-Two' => 'Subsección Uno-Dos', + 'Subsubsection One-Two-Four' => 'Subsubsección Uno-Dos-Cuatro', + 'Subsubsection One-Two-One' => 'Subsubsección Uno-Dos-Uno', + 'Subsubsection One-Two-Three' => 'Subsubsección Uno-Dos-Tress', + 'Subsubsection One-Two-Two' => 'Subsubsección Uno-Dos-Dos', + 'T2H_today' => '', + 'Table of Contents' => 'Tabla de contenidos', + 'This document was generated by @emph{%{user}} on @emph{%{date}} using @uref{%{program_homepage}, @emph{%{program}}}.' => 'Este documento fue generado pr @emph{%{user}} en @emph{%{date}} usando @uref{%{program_homepage}, @emph{%{program}}}.', + 'This document was generated by @emph{%{user}} using @uref{%{program_homepage}, @emph{%{program}}}.' => 'Este documento fue generado por @emph{%{user}} usando @uref{%{program_homepage}, @emph{%{program}}}.', + 'This document was generated on @i{%{date}} using @uref{%{program_homepage}, @i{%{program}}}.' => 'Este documento fue generado en @i{%{date}} usando @uref{%{program_homepage}, @i{%{program}}}.', + 'This document was generated using @uref{%{program_homepage}, @emph{%{program}}}.' => 'Este documento fue generado usando @uref{%{program_homepage}, @emph{%{program}}}.', + 'Top' => 'Inicio', + 'Untitled Document' => 'Documento sintítulo', + 'about (help)' => 'Acerca de (ayuda)', + 'beginning of this chapter or previous chapter' => 'Inicio del capítulo o capítulo anterior', + 'by @emph{%{user}}' => 'por @emph{%{user}}', + 'by @emph{%{user}} on @emph{%{date}}' => 'por @emph{%{user}} el @emph{%{date}}', + 'cover (top) of document' => 'Cubierta (inicio) del documento', + 'current' => 'actual', + 'current section' => 'Sección actual', + 'first section in reading order' => 'Primera sección en orden de lectura', + 'following node' => 'Nodo siguiente', + 'index' => 'Índice', + 'last section in reading order' => 'Última sección en orden de lectura', + 'next chapter' => 'Capítulo siguiente', + 'next node' => 'Nodo siguiente', + 'next section in reading order' => 'Sección siguiente en order de lectura', + 'next section on same level' => 'Sección siguiente en el mismo nivel', + 'node following in node reading order' => 'siguiente nodo en orden de lectura', + 'node up' => 'nodo arriba', + 'on @emph{%{date}}' => 'el @emph{%{date}}', + 'previous node' => 'nodo anterior', + 'previous section in reading order' => 'Sección anterior en orden de lectura', + 'previous section on same level' => 'Sección anterior en el mismo nivel', + 'section `%{section}\' in @cite{%{book}}' => 'sección `%{section}\' en @cite{%{book}}', + 'see %{node_file_href}' => 'Véase %{node_file_href}', + 'see %{node_file_href} @cite{%{book}}' => 'Véase %{node_file_href} @cite{%{book}}', + 'see %{node_file_href} section `%{section}\' in @cite{%{book}}' => 'Véase %{node_file_href} sección `%{section}\' en @cite{%{book}}', + 'see %{reference_name}' => 'Véase %{reference_name}', + 'see @cite{%{book}}' => 'Véase @cite{%{book}}', + 'see section %{reference_name}' => 'véase sección %{reference_name}', + 'see section `%{section}\' in @cite{%{book}}' => 'véase sección `%{section}\' en @cite{%{book}}', + 'short table of contents' => 'resumen del contenido', + 'table of contents' => 'Tabla de contenidos', + 'unknown' => 'desconocido', + 'up node' => 'nodo superior', + 'up section' => 'Sección superior' + }; + +$T2H_OBSOLETE_STRINGS->{'es'} = { + 'See' => 'Véase', + 'section' => 'sección', + 'see' => 'véase' + }; + +return 1; diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-menu.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-menu.texinfo new file mode 100644 index 0000000..0afc9ff --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-menu.texinfo @@ -0,0 +1,4 @@ +@menu +* Licenses:: +* Index:: +@end menu diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-nodes.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-nodes.texinfo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual-nodes.texinfo diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual.conf b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual.conf new file mode 100755 index 0000000..488ad84 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual.conf @@ -0,0 +1,43 @@ +# Este fichero controla la configuración del manual. Este fichero +# está dividido en diferentes secciones de configuración (e.g., `main' +# para organizar la configuración principal y `templates' para +# organizar la relación de asiganación plantillas-sección). Cada +# sección de configuración está organizada en pares de valores +# `variable = valor' usados para describir las preferencias de +# configuración. +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +[main] + +# Especifica el trasfondo de documentación usado por el manual. Este +# es el formato utilizado para redactar los ficheros fuentes del +# manual de documentación. +manual_backend = "texinfo" + +# Especifica el estilo de títulos utilizados por las secciones del +# manual. Los valores posibles para esta opción son `cap-each-word' +# para escribir la primera letra de cada palabra en el título con +# mayúscula y el resto en minúscula, `cap-first-word' para escribir +# solo la primera letra del título en mayúscula y el resto en +# minúscula; y `directory' para transformar el título en un camino de +# directorio. +manual_section_style = "cap-each-word" + +# Especifica el order con que se muestran las secciones en el manual. +# Los valores posibles para esta opción son `created' para ubicar las +# nuevas secciones creadas en orden de creación, `ordered' para +# ordenar las secciones alfabéticamente sin importar el orden con el +# cual fueron creadas; y `reversed' lo contrario the `ordered'. +manual_section_order = "created" + +[templates] + +# Especifica la relación entre los ficheros de plantilla y los +# ficheros de definición de secciones en el manual. La definición de +# las plantillas se escriben en forma de camino relativo en el +# izquierdo y la definición de secciones en forma de expresión regular +# en el lado derecho. +Chapters/section-functions.texinfo = "^.+-functions-[[:alnum:]]+\.texinfo$" +Chapters/section.texinfo = "^.+\.texinfo$" diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual.sed b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual.sed new file mode 100644 index 0000000..1887582 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual.sed @@ -0,0 +1,40 @@ +#!/bin/sed +# +# repository.sed -- This file provide Spanish transformations for +# texi2html outupt, based on The CentOS Project CSS definitions. +# +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +# Quotations. +s!

Nota!

Info

Nota

!g + +s!

Advertencia!

Advertencia

Advertencia

!g + +s!

Importante!

Importante

Importante

!g + +s!

Idea!

Idea

Idea

!g + +s!

Precaución!

Precaución

Precaución

!g + +s!

Convensión!

Convensión

Convensión

!g + +s!

Redirección!

Redirección

Redirección

!g diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual.texinfo b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual.texinfo new file mode 100644 index 0000000..991a60d --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/es_ES/manual.texinfo @@ -0,0 +1,75 @@ +\input texinfo @c -*-texinfo-*- +@c -- Header -------------------------------------------------- + +@setfilename =MANUAL_NAME=.info +@settitle =MANUAL_TITLE= +@documentlanguage es +@afourpaper +@finalout + +@c -- Variables ----------------------------------------------- + +@set TCENTOS The Community Enterprise Operating System +@set TCPROJ @url{http://www.centos.org/, The CentOS Project} +@set TCWIKI @url{http://wiki.centos.org/, The CentOS Wiki} +@set TCMLISTS @url{http://lists.centos.org/, The CentOS Mailing Lists} +@set TCBUGS @url{http://bugs.centos.org/, The CentOS Bugs} +@set TCMIRRORS @url{http://mirrors.centos.org/, The CentOS Mirrors} +@set TCPLANET @url{http://planet.centos.org/, The CentOS Planet} +@set TCFORUMS @url{http://forums.centos.org/, The CentOS Forums} +@set TCINFOML @email{centos-info@@centos.org, The CentOS Information Mailing List} +@set TCDEVSML @email{centos-devel@@centos.org, The CentOS Developers Mailing List} +@set TCDOCSML @email{centos-docs@@centos.org, The CentOS Documentation Mailing List} +@set TCARTWML @email{centos-artwork@@centos.org, The CentOS Artwork Mailing List} +@set TCL10NML @email{centos-l10n@@centos.org, The CentOS Localization Mailing List} +@set TCAR @url{https://projects.centos.org/svn/artwork/, The CentOS Artwork Repository} +@set TCAS @url{https://projects.centos.org/trac/artwork/, The CentOS Artwork SIG} + +@c -- Summary description and copyright ----------------------- + +@copying +=MANUAL_ABSTRACT= + +Copyright @copyright{} =COPYRIGHT_YEAR_LIST= =COPYRIGHT_HOLDER= + +Se otorga permiso para copiar, distribuir y/o modificar este documento +bajo los términos de la Licencia de Documentación Libre de GNU, +Versión 1.1 o cualquier otra versión posterior publicada por la Free +Software Foundation; con las Secciones Invariantes, con Textos de +Cubierta Delantera, y con los Textos de Cubierta Trasera. Una copia de +la licencia está incluida en la sección titulada @ref{GNU Free +Documentation License}. +@end copying + +@c -- Titlepage, contents, copyright --------------------------- + +@titlepage +@title =MANUAL_TITLE= +@subtitle =MANUAL_SUBTITLE= +@author =COPYRIGHT_HOLDER= +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage +@contents + +@c -- `Top' node and master menu ------------------------------- + +@ifnottex +@node Top +@top =MANUAL_TITLE= +@insertcopying +@end ifnottex + +@include =MANUAL_NAME=-menu.texinfo + +@c -- The body of the document -------------------------------- + +@include =MANUAL_NAME=-nodes.texinfo + +@c -- The end of the document --------------------------------- + +@include Licenses/chapter.texinfo +@include =MANUAL_NAME=-index.texinfo + +@bye diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/manual-init.pl b/Scripts/Bash/Functions/Help/Texinfo/Templates/manual-init.pl new file mode 100755 index 0000000..6dfc09d --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/manual-init.pl @@ -0,0 +1,389 @@ +#!/usr/bin/perl +# +# repository.init -- This file initializes Texi2HTML program to +# produce the repository documentation manual using the CentOS Web +# Environment XHTML and CSS standard definition. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +# -iso +# if set, ISO8859 characters are used for special symbols (like +# copyright, etc) +$USE_ISO = 1; + +# -I +# add a directory to the list of directories where @include files are +# searched for (besides the directory of the file). additional '-I' +# args are appended to this list. (APA: Don't implicitely search ., +# to conform with the docs!) my @INCLUDE_DIRS = ("."); +@INCLUDE_DIRS = ("/home/centos/artwork"); + +# Extension used on output files. +$EXTENSION = "xhtml"; + +# Horizontal rules. +$DEFAULT_RULE = '


'; +$SMALL_RULE = $DEFAULT_RULE; +$MIDDLE_RULE = $DEFAULT_RULE; +$BIG_RULE = $DEFAULT_RULE; + +# -split section|chapter|node|none +# if $SPLIT is set to 'section' (resp. 'chapter') one html file per +# section (resp. chapter) is generated. If $SPLIT is set to 'node' one +# html file per node or sectionning element is generated. In all these +# cases separate pages for Top, Table of content (Toc), Overview and +# About are generated. Otherwise a monolithic html file that contains +# the whole document is created. +$SPLIT = 'section'; + +# -sec-nav|-nosec-nav +# if this is set then navigation panels are printed at the beginning +# of each section. If the document is split at nodes then navigation +# panels are printed at the end if there were more than $WORDS_IN_PAGE +# words on page. +# +# If the document is split at sections this is ignored. +# +# This is most useful if you do not want to have section navigation +# with -split chapter. There will be chapter navigation panel at the +# beginning and at the end of chapters anyway. +$SECTION_NAVIGATION = 1; + +# Layout control +$print_page_head = \&T2H_XHTML_print_page_head; +$print_page_foot = \&T2H_XHTML_print_page_foot; +$print_frame = \&T2H_XHTML_print_frame; +$button_icon_img = \&T2H_XHTML_button_icon_img; +$print_navigation = \&T2H_XHTML_print_navigation; + +#FIXME update once it is more stabilized in texi2html.init +sub T2H_XHTML_print_page_head +{ + my $fh = shift; + my $longtitle = "$Texi2HTML::THISDOC{'title_unformatted'}"; + $longtitle .= ": $Texi2HTML::UNFORMATTED{'This'}" if exists $Texi2HTML::UNFORMATTED{'This'}; + print $fh < + + + + + $longtitle + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + +EOT +} + +sub T2H_XHTML_print_page_foot +{ + my $fh = shift; + my @date=localtime(time); + my $year=$date[5] += 1900; + my $program_string = program_string(); + print $fh <$program_string

+ +
+ +
+ + +
+ + + + +EOT +} + +# / in +sub T2H_XHTML_button_icon_img +{ + my $button = shift; + my $icon = shift; + my $name = shift; + return '' if (!defined($icon)); + if (defined($name) && $name) + { + $name = ": $name"; + } + else + { + $name = ''; + } + $button = "" if (!defined ($button)); + return qq{$button$name}; +} + +$simple_map{'*'} = '
'; + +# formatting functions + +$def_line = \&t2h_xhtml_def_line; +$index_summary = \&t2h_xhtml_index_summary; +$image = \&t2h_xhtml_image; + +# need / in +sub t2h_xhtml_image($$$) +{ + my $file = shift; + my $base = shift; + my $preformatted = shift; + return "[ $base ]" if ($preformatted); + return "\"$base\""; +} + +# process definition commands line @deffn for example +# replaced by +sub t2h_xhtml_def_line($$$$$) +{ + my $category = shift; + my $name = shift; + my $type = shift; + my $arguments = shift; + my $index_label = shift; + $index_label = '' if (!defined($index_label)); + $name = '' if (!defined($name) or ($name =~ /^\s*$/)); + $type = '' if (!defined($type) or $type =~ /^\s*$/); + if (!defined($arguments) or $arguments =~ /^\s*$/) + { + $arguments = ''; + } + else + { + $arguments = '' . $arguments . ''; + } + my $type_name = ''; + $type_name = " $type" if ($type ne ''); + $type_name .= ' ' . $name . '' if ($name ne ''); + $type_name .= $arguments . "\n"; + if (! $DEF_TABLE) + { + return '
'. '' . $category . ':' . $type_name . $index_label . "
\n"; + } + else + { + + return "\n" . $type_name . + "\n" . $category . $index_label . "\n" . "\n"; + } +} + +# There is a br which needs / +sub t2h_xhtml_index_summary($$) +{ + my $alpha = shift; + my $nonalpha = shift; + my $join = ''; + my $nonalpha_text = ''; + my $alpha_text = ''; + $join = "   \n
\n" if (@$nonalpha and @$alpha); + if (@$nonalpha) + { + $nonalpha_text = join("\n   \n", @$nonalpha) . "\n"; + } + if (@$alpha) + { + $alpha_text = join("\n   \n", @$alpha) . "\n   \n"; + } + #I18n + return "
" . &$I('Jump to') . ":   " . + $nonalpha_text . $join . $alpha_text . '
'; +} + +# Layout of navigation panel +sub T2H_XHTML_print_navigation +{ + my $fh = shift; + my $buttons = shift; + my $vertical = shift; + print $fh '' . "\n"; + + print $fh "" unless $vertical; + for my $button (@$buttons) + { + print $fh qq{\n} if $vertical; + print $fh qq{\n"; + print $fh "\n" if $vertical; + } + print $fh "" unless $vertical; + print $fh "\n"; +} + +# Use icons for navigation. +$ICONS = 0; + +# insert here name of icon images for buttons +# Icons are used, if $ICONS and resp. value are set +%ACTIVE_ICONS = + ( + 'Top', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-top.png', + 'Contents', 'file:///usr/share/icons/Bluecurve/24x24/stock/help-contents.png', + 'Overview', '', + 'Index', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-find.png', + 'This', '', + 'Back', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png', + 'FastBack', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-first.png', + 'Prev', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png', + 'Up', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-up.png', + 'Next', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png', + 'NodeUp', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-up.png', + 'NodeNext', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png', + 'NodePrev', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png', + 'Following', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png', + 'Forward', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png', + 'FastForward', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-last.png', + 'About' , 'file:///usr/share/icons/Bluecurve/24x24/stock/gtk-about.png', + 'First', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-first.png', + 'Last', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-last.png', + ' ', '' + ); + +# Insert here name of icon images for these, if button is inactive +%PASSIVE_ICONS = + ( + 'Top', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-top.png', + 'Contents', 'file:///usr/share/icons/Bluecurve/24x24/stock/help-contents.png', + 'Overview', '', + 'Index', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-find.png', + 'This', '', + 'Back', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png', + 'FastBack', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-first.png', + 'Prev', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png', + 'Up', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-up.png', + 'Next', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png', + 'NodeUp', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-up.png', + 'NodeNext', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png', + 'NodePrev', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png', + 'Following', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png', + 'Forward', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png', + 'FastForward', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-last.png', + 'About' , 'file:///usr/share/icons/Bluecurve/24x24/stock/gtk-about.png', + 'First', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-first.png', + 'Last', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-last.png', + ' ', '' + ); + +return 1; diff --git a/Scripts/Bash/Functions/Help/Texinfo/Templates/manual.sed b/Scripts/Bash/Functions/Help/Texinfo/Templates/manual.sed new file mode 100644 index 0000000..2b89341 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/Templates/manual.sed @@ -0,0 +1,29 @@ +#!/bin/sed +# +# repository.sed -- This file provides common transformations for +# texi2html output, based on The CentOS Project CSS definitions. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +# Links +#s!
${MANUAL_CHAPTER_DIR}/chapter-nodes.${MANUAL_EXTENSION} + + # Print action maessage. + cli_printMessage "`gettext "Updating chapter menu and nodes inside manual structure."`" --as-response-line + + # Update chapter information inside the manual's texinfo + # structure. + texinfo_updateChapterMenu + texinfo_updateChapterNodes + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_createStructure.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_createStructure.sh new file mode 100755 index 0000000..ca41807 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_createStructure.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# +# texinfo_createStructure.sh -- This function creates the +# documentation structure of a manual using the current language as +# reference. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_createStructure { + + # Verify manual main definition file. If it already exist, assume + # it was correctly created in the past. Otherwise try to create + # it. Don't use the manual base directory here, it would prevent + # documentation manuals from being created on different languages. + if [[ -f ${MANUAL_BASEFILE}.${MANUAL_EXTENSION} ]];then + return + else + cli_printMessage "-" --as-separator-line + cli_printMessage "`eval_gettext "The following documentation manual will be created:"`" + cli_printMessage "${MANUAL_BASEFILE}.texinfo" --as-response-line + cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line + fi + + # Initialize manual's information (e.g., title, subtitle, abstract). + local MANUAL_TITLE='' + local MANUAL_SUBTITLE='' + local MANUAL_ABSTRACT='' + + # Create manual's top-level directory using subversion. This is + # the place where all texinfo documentation manuals is stored in. + if [[ ! -d ${MANUAL_BASEDIR} ]];then + svn mkdir ${MANUAL_BASEDIR} --quiet + fi + + # Create manual's base directory. This is the place where + # language-specific documentation source files are stored in. + svn mkdir ${MANUAL_BASEDIR_L10N} --quiet + + # Retrive manual's information from standard input. + cli_printMessage "`gettext "Manual Title"`" --as-request-line + read MANUAL_TITLE + cli_printMessage "`gettext "Manual Subtitle"`" --as-request-line + read MANUAL_SUBTITLE + cli_printMessage "`gettext "Manual Abstract"`" --as-request-line + read MANUAL_ABSTRACT + + # Print action message. + cli_printMessage "-" --as-separator-line + cli_printMessage "`gettext "Creating manual structure in texinfo format."`" --as-response-line + + # Verify manual's information. The title information must be + # non-empty value. + if [[ $MANUAL_TITLE == '' ]];then + cli_printMessage "`gettext "The manual title cannot be empty."`" --as-error-line + fi + + # Define file names required to build the manual. + local FILE='' + local FILES=$(cli_getFilesList "${MANUAL_TEMPLATE_L10N}" \ + --maxdepth='1' \ + --pattern="manual((-menu|-nodes|-index)?\.${MANUAL_EXTENSION}|\.conf)") + + # Verify manual base file. The manual base file is where the + # documentation manual is defined in the backend format. Assuming + # no file exists (e.g., a new language-specific manual is being + # created), use texinfo templates for it. + for FILE in $FILES;do + if [[ ! -f ${MANUAL_BASEDIR_L10N}/$(basename ${FILE}) ]];then + + # Be sure the file is inside the working copy and under + # version control. + cli_checkFiles ${FILE} -wn + + # Define target file. + local DST=${MANUAL_BASEDIR_L10N}/$(basename ${FILE} \ + | sed -r "s!manual!${MANUAL_NAME}!") + + # Copy using subversion to register this action. + svn cp ${FILE} ${DST} --quiet + + # Expand common translation markers inside target file. + cli_expandTMarkers ${DST} + + # Expand specific translation markers inside target file. + sed -r -i -e "s!=MANUAL_NAME=!${MANUAL_NAME}!g" \ + -e "s!=MANUAL_TITLE=!${MANUAL_TITLE}!g" \ + -e "s!=MANUAL_SUBTITLE=!${MANUAL_SUBTITLE}!g" \ + -e "s!=MANUAL_ABSTRACT=!${MANUAL_ABSTRACT}!g" $DST + + fi + done + + # Initialize chapter structure inside the manual. + texinfo_createStructureChapters + + # Redefine absolute path to changed directory. + MANUAL_CHANGED_DIRS=${MANUAL_BASEDIR} + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_createStructureChapters.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_createStructureChapters.sh new file mode 100755 index 0000000..37a3a38 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_createStructureChapters.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# texinfo_createStructureChapters.sh -- This function initiates the +# chapter documentation structure of a manual, using the current +# language and template files as reference. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_createStructureChapters { + + local MANUAL_CHAPTER_DIR='' + + # Define list of chapter templates files used to build the + # documentation manual. Do not include the `Chapters' directory + # here. It is used to build chapters based on value passed though + # `--chapter' option passed in the command-line. + local FILE='' + local FILES=$(cli_getFilesList ${MANUAL_TEMPLATE_L10N} \ + --pattern='chapter(-menu|-nodes)?\.texinfo' --mindepth='2' \ + | grep -v '/Chapters/') + + # Loop through chapter structures and create them inside the + # manual. + for FILE in $FILES;do + + # Redefine manual's chapter directory based on template files. + MANUAL_CHAPTER_DIR=${MANUAL_BASEDIR_L10N}/$(basename $(dirname ${FILE})) + + # Verify texinfo templates used as based to build the chapter. + # Be sure they are inside the working copy of CentOS Artwork + # Repository (-w) and under version control (-n), too. + cli_checkFiles ${FILE} -wn + + # Verify chapter's directory. If it doesn't exist, create it. + if [[ ! -d ${MANUAL_CHAPTER_DIR} ]];then + svn mkdir ${MANUAL_CHAPTER_DIR} --quiet + fi + + # Copy template files into chapter's directory. + svn cp ${FILE} ${MANUAL_CHAPTER_DIR} --quiet + + done + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh new file mode 100755 index 0000000..dbbd981 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# texinfo_deleteCrossReferences.sh -- This function looks inside +# texinfo source files, from section level on, and removes all cross +# referece definitions related to a documentation entry. Use this +# function in coordination with texinfo_deleteEntry function, in order +# to keep cross reference information, inside the documentation +# manual, syncronized. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_deleteCrossReferences { + + local -a PATTERN + local -a REPLACE + + # Define documentation entry. + local MANUAL_ENTRY="$1" + + # Verify documentation entry. If documentation entry is empty, + # stop script execution with an error message. + if [[ $MANUAL_ENTRY == '' ]];then + cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line + fi + + # Build the node string using entry location. + local NODE="$(texinfo_getEntryNode "$MANUAL_ENTRY")" + + # Define regular expression patterns for texinfo cross reference + # commands. + PATTERN[0]="@(pxref|xref|ref)\{(${NODE})\}" + REPLACE[0]='--- @strong{'`gettext "Removed"`'}(\1:\2) ---' + + # Define replacement string for missing entries. It is convenient + # to keep missing entries in documentation for documentation team + # to know. Removing the missing cross reference may intorudce + # confussion. Imagine that! you are spending lots of hours in an + # article and suddenly one of your cross refereces disappears with + # no visible reason, with the next working copy update you + # perform. That's frustrating. Instead, when centos-art.sh script + # finds a missing cross reference it removes the link and remark + # the issue for you to act on it. + PATTERN[1]="^(\* ${NODE}:(.*):(.*))$" + REPLACE[1]='\@comment --- '`gettext "Removed"`'(\1) ---' + + # Define list of entries to process. + local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR_L10N} \ + --pattern=".+\.${MANUAL_EXTENSION}") + + # Update node-related cross references. The node-related cross + # reference definition, long ones specially, could require more + # than one line to be set. By default, GNU sed does not matches + # newline characters in the pattern space, so we need to make use + # of `label' feature and the `N' command in order to build a + # pattern space that includes the newline character in it. Here we + # use the `a' letter to name the label we use, followed by N + # command to add a newline to the pattern space, the s command to + # make the pattern replacement using the `g' flag to make it + # global and finaly the command `b' to branch label named `a'. + sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${MANUAL_ENTRIES} + + # Update menu-related cross references. Menu-related cross + # references hardly appear in more than one line, so there is no + # need to complicate much the replacement command. + sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${MANUAL_ENTRIES} + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntry.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntry.sh new file mode 100755 index 0000000..897722e --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntry.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# texinfo_deleteEntry.sh -- This function removes a documentation +# manuals, chapters or sections from the working copy. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_deleteEntry { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Remove manual, chapter or section based on documentation entry + # provided as non-option argument to `centos-art.sh' script. + if [[ ${MANUAL_SECT[$MANUAL_DOCENTRY_ID]} != '' ]];then + + # When a section is deleted, documentation entry points to a + # section name. In this configuration, documentation entry is + # deleted through subversion in order to register the change. + # Once the documentation entry is deleted, the section menu + # and nodes definition files are updated to keep manual in a + # consistent state. + texinfo_deleteEntrySection + + elif [[ ${MANUAL_CHAP[$MANUAL_DOCENTRY_ID]} != '' ]];then + + # When a chapter is deleted, documentation entry doesn't point + # to a section name but a chapter name. In this configuration, + # it is necessary to build a list of all the section entries + # available inside the chapter before deleting it. Once the + # chapter has been marked for deletion, it is time to update + # chapter definition files and later section definition files + # using the list of section entries previously defined. + # Actualization of section definition files must be done one + # at a time because menu entries related to section + # definitions are updated one at a time. + texinfo_deleteEntryChapter + + elif [[ ${MANUAL_DIRN[$MANUAL_DOCENTRY_ID]} != '' ]];then + + # When a manual is deleted, documentation entry doesnt' point + # to either a section or chapter but a manual name only. In + # this configuration the entire manual directory is marked for + # deletion, and that way processed. + texinfo_deleteEntryManual + + else + cli_printMessage "`gettext "The parameters you provided are not supported."`" --as-error-line + fi + + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntryChapter.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntryChapter.sh new file mode 100755 index 0000000..64983c8 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntryChapter.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# +# texinfo_deleteEntryChapter.sh -- This function standardizes chapter +# deletion inside the manual structure. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_deleteEntryChapter { + + # Print action message. + cli_printMessage "$MANUAL_CHAPTER_DIR" --as-deleting-line + + # Verify existence of documentation entry before deleting it. We + # cannot delete an entry which doesn't exist. + cli_checkFiles "$MANUAL_CHAPTER_DIR" + + # Build list of section entries inside the chapter. This is + # required to delete cross references from other section entries + # that point to section entries inside the chapter that will be + # deleted. Take care don't include the chapter definition files. + local MANUAL_ENTRIES=$(cli_getFilesList $MANUAL_CHAPTER_DIR \ + --pattern=".+\.${MANUAL_EXTENSION}" \ + | egrep -v '/chapter') + + # Revert pending changes before deleting. + svn revert ${MANUAL_CHAPTER_DIR} --quiet --recursive + + # Remove chapter directory using subversion to register the + # change. + svn del ${MANUAL_CHAPTER_DIR} --quiet + + # Update chapter menu and nodes inside manual structure. + texinfo_updateChapterMenu --delete-entry + texinfo_updateChapterNodes + + # Loop through section entries retrived from chapter, before + # deleting it, in order to remove cross references pointing to + # those section entries. Since the chapter and all its sections + # have been removed, cross references pointing them will point to + # non-existent section entries. This way, all cross references + # pointing to non-existent section entries will be transformed in + # order for documentors to advertise the section entry state. + for MANUAL_ENTRY in $MANUAL_ENTRIES;do + texinfo_deleteCrossReferences ${MANUAL_ENTRY} + done + +} + diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntryManual.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntryManual.sh new file mode 100755 index 0000000..381fea5 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntryManual.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# texinfo_deleteEntryManual.sh -- This function standardized manual +# deletion inside the working copy. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_deleteEntryManual { + + # Print action message. + cli_printMessage "$MANUAL_ENTRY" --as-deleting-line + + # Verify existence of documentation entry before deleting it. We + # cannot delete an entry which doesn't exist. + cli_checkFiles "$MANUAL_ENTRY" + + # Revert pending changes before deleting. + svn revert ${MANUAL_BASEDIR_L10N} --quiet --recursive + + # Remove locale-specific documentation manual directory from the + # working copy. Using subversion to register the change. Be sure + # that related output files are removed too. + svn del ${MANUAL_BASEDIR_L10N} --quiet --force + + # Verify manual base directory. When the locale-specific + # documentaion manual is the last one inside the manual base + # directory, remove the manual base directory from the working + # copy. There is no need to have an empty manual base directories + # inside the working copy. + if [[ $(ls -1 $MANUAL_BASEDIR | wc -l) -le 1 ]];then + + # Remove manual base directory. + svn del ${MANUAL_BASEDIR} --quiet --force + + # Redefine absolute paths to changed directory. This is + # required in order for `cli_commitRepoChanges' to be aware + # that we are deleting MANUAL_BASEDIR, not + # MANUAL_BASEDIR_L10N. + MANUAL_CHANGED_DIRS="${MANUAL_BASEDIR}" + + fi + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntrySection.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntrySection.sh new file mode 100755 index 0000000..f681282 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_deleteEntrySection.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# texinfo_deleteEntrySection.sh -- This function standardized section +# deletion inside the manual structure. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_deleteEntrySection { + + # Print action message. + cli_printMessage "$MANUAL_ENTRY" --as-deleting-line + + # Verify existence of documentation entry before deleting it. We + # cannot delete an entry which doesn't exist. + cli_checkFiles "$MANUAL_ENTRY" + + # Revert pending changes inside the section entry in order to + # prepare the file for deletion. + svn revert $MANUAL_ENTRY --quiet + + # Remove documentation entry using subversion to register the + # change. + svn del $MANUAL_ENTRY --quiet + + # Update section menu, nodes and cross references. + texinfo_updateStructureSection "${MANUAL_ENTRY}" --delete + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_editEntry.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_editEntry.sh new file mode 100755 index 0000000..0a85fae --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_editEntry.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# +# texinfo_editEntry.sh -- This function implements the edition flow of +# documentation entries inside the working copy. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_editEntry { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Verify section definition inside chapters. + if [[ ! -f $MANUAL_ENTRY ]];then + + # Verify chapter related to documentation entry. Inside + # manuals, all documentation entries are stored directly under + # its chapter directory. There is no more levels deep so it is + # possible to perform a direct chapter verification here. + if [[ ! -a $(dirname $MANUAL_ENTRY)/chapter.${MANUAL_EXTENSION} ]];then + texinfo_createChapter + fi + + # Print confirmation question. + cli_printMessage "`gettext "The following documentation section will be created:"`" + cli_printMessage "$MANUAL_ENTRY" --as-response-line + cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line + + # Update section menu, nodes and cross references based on + # changes in order for manual structure to remain cosistent. + texinfo_updateStructureSection "$MANUAL_ENTRY" + + # Use default text editor to write changes on documentation entry. + $EDITOR $MANUAL_ENTRY + + else + + # Print action message. + cli_printMessage "$MANUAL_ENTRY" --as-updating-line + + # Rebuild section menu definitions before editing the + # documentation entry. This way, if there is any change in the + # section menu definition, it will be visible to you on + # edition. + texinfo_makeSeeAlso "$MANUAL_ENTRY" + + # Use default text editor to write changes on documentation entry. + $EDITOR $MANUAL_ENTRY + + # Rebuild section menu definitions after editing the + # documentation entry. This way, if there is any change or + # expansion to realize in the section menu definition, it be + # applied right now. Don't see a reason for waiting until the + # next edition for expansions to happen. + texinfo_makeSeeAlso "$MANUAL_ENTRY" + + fi + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntry.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntry.sh new file mode 100755 index 0000000..2f4162e --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntry.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# texinfo_getEntry.sh -- This function builds a documentation entry +# based on location specified as first positional parameter. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_getEntry { + + local MANUAL_ENTRY='' + local MANUAL_SECTION_NAME='' + local MANUAL_SECTION_NAMES="$@" + + # Loop through list of section names. + for MANUAL_SECTION_NAME in $MANUAL_SECTION_NAMES;do + + # Define absolute path to documentation entry. + MANUAL_ENTRY=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAPTER_NAME}/${MANUAL_SECTION_NAME}.${MANUAL_EXTENSION} + + # Output entry's absolute path. + echo ${MANUAL_ENTRY} + + done + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntryIndex.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntryIndex.sh new file mode 100755 index 0000000..4e5762e --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntryIndex.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# texinfo_getEntryTitle.sh -- This function standardizes the way +# values for chapter and section index definitions are printed out. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_getEntryIndex { + + # Initialize phrase we want to transform based on style provided. + local PHRASE="$1" + + # In the entire phrase provided, capitalize the first word only. + PHRASE=$(echo "${PHRASE}" | tr '[:upper:]' '[:lower:]' \ + | sed -r 's!^([[:alpha:]])!\u\1!') + + # Output transformed phrase. + echo "$PHRASE" + +} + diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntryNode.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntryNode.sh new file mode 100755 index 0000000..5472959 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntryNode.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# texinfo_getEntryNode.sh -- This function cleans up the action value +# (ACTIONVAL) directory to make a node name from it. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_getEntryNode { + + # Define documentation entry. + local MANUAL_ENTRY="$1" + + # Verify documentation entry. + if [[ $MANUAL_ENTRY == '' ]];then + cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line + fi + + # Define node from documentation entry. + local NODE=$(echo "$MANUAL_ENTRY" | sed -r \ + -e "s!^${MANUAL_BASEDIR_L10N}/!!" \ + -e "s/\.${MANUAL_EXTENSION}$//" \ + -e "s!chapter!!" \ + -e 's!(/|-)! !g' \ + -e 's!\<([[:alpha:]]+)\>!\u\1!g' \ + -e 's!^[[:space:]]+!!') + + echo "$NODE" + +} + diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntryTitle.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntryTitle.sh new file mode 100755 index 0000000..a733095 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_getEntryTitle.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# +# texinfo_getEntryTitle.sh -- This function standardizes the way entry +# titles for chapters and sections are printed out. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_getEntryTitle { + + # Initialize phrase we want to transform based on style provided. + local PHRASE="$1" + + # Define section style. Through this property you can customize + # the section title in predefined ways. By default, section + # titles are printed with each word capitalized (`cap-each-word'). + # Other values to this option are `cap-first-only' (to capitalize + # just the first word in the title) or `directory' to transform + # each word to a directory path. + local MANUAL_SECTION_STYLE=$(cli_getConfigValue "${MANUAL_CONFIG_FILE}" "main" "manual_section_style") + if [[ ! $MANUAL_SECTION_STYLE =~ '^(cap-each-word|cap-first-only|directory)$' ]];then + MANUAL_SECTION_STYLE='cap-each-word' + fi + + # Verify section style provided and transform the phrase value in + # accordance with it. + case $MANUAL_SECTION_STYLE in + + 'cap-first-only' ) + + # In the entire phrase provided, capitalize the first word + # only. + PHRASE=$(echo "${PHRASE}" | tr '[:upper:]' '[:lower:]' \ + | sed -r 's!^([[:alpha:]])!\u\1!') + ;; + + 'directory' ) + + # In the entire phrase provided, concatenate all words + # with slash (/) character and remark the fact it is a + # directory. + PHRASE=$(echo "${PHRASE}" | sed -r \ + -e 's/(Trunk|Branches|Tags)/\l\1/' \ + -e 's/ /\//g' \ + -e 's/\/([[:alpha:]])/\/\u\1/g') + + PHRASE="@file{$PHRASE}" + ;; + + 'cap-each-word' | * ) + + # In the entire phrase provided, capitalize all words. + PHRASE=$(echo "${PHRASE}" | tr '[:upper:]' '[:lower:]' \ + | sed -r 's!\<([[:alpha:]]+)\>!\u\1!g') + ;; + + esac + + # Output transformed phrase. + echo "$PHRASE" + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_makeSeeAlso.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_makeSeeAlso.sh new file mode 100755 index 0000000..310d95d --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_makeSeeAlso.sh @@ -0,0 +1,149 @@ +#!/bin/bash +# +# texinfo_makeSeeAlso.sh -- This function creates a list of links with +# section entries one level ahead from the current section entry being +# processed. Desition of what of these texinfo definitions to use is +# set inside the section entry itself, through the following +# construction: +# +# @c -- <[centos-art(SeeAlso,TYPE) +# @c -- ]> +# +# In this construction, the TYPE variable can be either `itemize', +# `enumerate' or `menu'. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_makeSeeAlso { + + # Initialize variables. + local CHILD_ENTRIES='' + local CHILD_ENTRY='' + local ENTRY_PATTERN='' + local LIST_DEF='' + local LIST_ENTRIES='' + local LIST_TYPE='' + local LIST_TYPE_PATTERN='' + local MANUAL_ENTRY='' + local TMARK='' + local TMARK_PATTERN='' + local TMARKS='' + + # Define absolute path to section entry. + MANUAL_ENTRY="$1" + + # Verify section entry. When section entries are deleted, there is + # no menu definition to set. + if [[ ! -f $MANUAL_ENTRY ]];then + return + fi + + # Define `SeeAlso' transltaion marker regular expression pattern. + TMARK_PATTERN="^@c -- <\[${CLI_PROGRAM}\(SeeAlso(,(itemize|enumerate|menu))?\)$" + + # Retrive `SeeAlso' translation marker definition lines. Be sure + # to retrive unique definitions only. If the same definition is + # present more than once, it will be expanded in one pass. There's + # no need to go through different passes in order to expand + # repeated translation marker definition. + TMARKS=$(egrep "${TMARK_PATTERN}" $MANUAL_ENTRY | sort | uniq) + + # Remove spaces from translation marker definition lines in order + # to process them correctly. Otherwise the definition line would + # be broken on each space character and then that wouldn't be the + # definition line we initially conceived. + TMARKS=$(echo "$TMARKS" | sed -r 's/ /\\040/g') + + # Define pattern used to build list of child sections. A child + # section shares the same path information of its parent with out + # file extension. For example, if you have the `identity', + # `identity-images' and `identity-images-themes' section entries, + # `identity-images' is a child entry of `identity' likewise + # `identity-images-themes' is a child entry of `identity-images'. + ENTRY_PATTERN=$(echo "$MANUAL_ENTRY" | sed -r "s/\.${MANUAL_EXTENSION}$//") + + # Define list of child entries we'll use as reference to build the + # menu nodes. Reverse the output here to produce the correct value + # based on menu nodes definition set further. + CHILD_ENTRIES=$(cli_getFilesList $(dirname ${MANUAL_ENTRY}) \ + --pattern="${ENTRY_PATTERN}-[[:alnum:]]+\.${MANUAL_EXTENSION}" | sort -r | uniq ) + + # Loop through translation marker definition lines. + for TMARK in $TMARKS;do + + # Define list type based on translation marker definition. + # Remember to revert back the space character transformation + # we previously did, in order for the translation marker + # regular expression pattern to match. + LIST_TYPE=$(echo "$TMARK" | sed -r -e 's/\\040/ /g' -e "s/${TMARK_PATTERN}/\2/") + + # Define list type default value. This is, the list type used + # when no list type is specified in the translation marker + # construction properties field. + if [[ $LIST_TYPE == '' ]];then + LIST_TYPE="itemize" + fi + + # Define list properties (type included). + LIST_PROP=$(echo "$TMARK" | sed -r -e 's/\\040/ /g' -e "s/${TMARK_PATTERN}/\1/") + + # Define `SeeAlso' transltaion marker regular expression + # pattern that matches the translation marker definition. + # Notice that we cannot use TMARK_PATTERN here because it + # includes a selection list of all possible translation + # markers that can provided and here we need to precisely set + # the one being currently processed, not those whose could be + # processed. + LIST_TYPE_PATTERN="^@c -- <\[${CLI_PROGRAM}\(SeeAlso${LIST_PROP}\)$" + + # Redefine list's entry based on translation marker definition. + if [[ $LIST_TYPE =~ '^menu$' ]];then + for CHILD_ENTRY in $CHILD_ENTRIES;do + LIST_ENTRIES="* $(texinfo_getEntryNode "$CHILD_ENTRY")::\n${LIST_ENTRIES}" + done + elif [[ $LIST_TYPE =~ '^(itemize|enumerate)$' ]];then + for CHILD_ENTRY in $CHILD_ENTRIES;do + LIST_ENTRIES="@item @ref{$(texinfo_getEntryNode "$CHILD_ENTRY")}\n${LIST_ENTRIES}" + done + else + # When an translation marker isn't recognize, go on with + # the next one in the list. + continue + fi + + # Define menu using menu nodes. + LIST_DEF="@c -- <[${CLI_PROGRAM}(SeeAlso${LIST_PROP})\n@${LIST_TYPE}\n${LIST_ENTRIES}@end ${LIST_TYPE}\n@c -- ]>" + + # Expand list definition using translation marker and list + # definition itself. Be sure that no expansion be done when + # the closing tag of translation marker isn't specified. + # Otherwise, there might be lost of content. + sed -r -i "/${LIST_TYPE_PATTERN}/{:a;N;/\n@c -- ]>$/!ba;s/.*/${LIST_DEF}/;}" $MANUAL_ENTRY + + # Clean up both list definition and list entries. Otherwise + # undesired concatenations happen. + LIST_DEF='' + LIST_ENTRIES='' + LIST_TYPE='' + + done + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh new file mode 100755 index 0000000..0ffc543 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# +# texinfo_renameCrossReferences.sh -- This function renames menu, +# nodes and cross references related to chapters and sections that +# have been renamed previously. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_renameCrossReferences { + + local -a PATTERN + local -a REPLACE + + # Build source and target node definitions. + local NODE_SRC="$(texinfo_getEntryNode "$MANUAL_ENTRY_SRC")" + local NODE_DST="$(texinfo_getEntryNode "$MANUAL_ENTRY_DST")" + + # Define regular expression pattern and its replacement for node + # definitions that have been previously removed. + PATTERN[0]="--- @strong\{`gettext "Removed"`\}\((pxref|xref|ref):\<${NODE_SRC}\>(.*)\) ---" + REPLACE[0]="\@\1{${NODE_DST}\2}" + + # Define regular expression pattern and its replacement for menu + # definitions that have been previously removed. + PATTERN[1]="^@comment --- `gettext "Removed"`\(\* \<${NODE_SRC}\>(.*)\) ---$" + REPLACE[1]="* ${NODE_DST}\1" + + # Define list of entries to process. This is, all the texinfo + # source files the documentation manual is made of. + local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR_L10N} \ + --pattern=".+\.${MANUAL_EXTENSION}") + + # Update node cross references. The node-related cross reference + # definition, long ones specially, could require more than one + # line to be set. By default, GNU sed does not matches newline + # characters in the pattern space, so we need to make use of + # `label' feature and the `N' command in order to build a pattern + # space that includes the newline character in it. Here we use the + # `a' letter to name the label we use, followed by N command to + # add a newline to the pattern space, the s command to make the + # pattern replacement using the `g' flag to make it global and + # finaly the command `b' to branch label named `a'. + # + # Inside the pattern space, the `\<' and `\>' are used to restrict + # the match pattern to a word boundary. The word boundary + # restriction applied here is required to avoid undesired + # replacements when we replace singular words with their plurals. + # For example, if we need to change the node `Manual' to its + # plular (i.e., `Manuals'), and no boundary restriction is used in + # the pattern space to do that, we might end up having nodes like + # `Manualsssss' which probably doesn't exist. This is because this + # sed command might be applied to the same file more than once; + # and each time it is applied, a new `Manuals' replaces the + # previous `Manuals' replacement to form `Manualss', `Manualsss', + # and so on for each interaction. Using word boundaries + # restrictions prevent such issue from happening. + sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${MANUAL_ENTRIES} + + # Update menu cross references. Menu cross reference definitions + # hardly appear in more than one line, so there is no need to + # complicate the replacement command. + sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${MANUAL_ENTRIES} + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntry.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntry.sh new file mode 100755 index 0000000..8497a31 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntry.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# +# texinfo_renameEntry.sh -- This function standardizes renaming tasks +# related to manual, chapters and sections inside the working copy. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_renameEntry { + + # Initialize source and target locations. + local MANUAL_ENTRY_SRC='' + local MANUAL_ENTRY_DST='' + + # Define both source and target documentation entries. To build + # the source and target documentation entries we take into + # consideration the manual's main definition file, the chapter's + # main definition file and non-option arguments passed to + # centos-art.sh script through the command-line. + if [[ ${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]} != '' ]];then + + # When a section is renamed, the section source location is + # duplicated into the section target location and later + # removed from the working copy. Once the section source + # location has been renamed, the section menu, nodes and cross + # references are updated to keep consistency inside the + # manual. + texinfo_renameEntrySection + + elif [[ ${MANUAL_CHAP[$MANUAL_DOCENTRY_ID]} != '' ]] \ + && [[ ${MANUAL_CHAP[(($MANUAL_DOCENTRY_ID + 1))]} != '' ]];then + + # When a chapter is renamed, the chapter source location is + # duplicated into the chapter source location and later + # removed from the working copy. Once the chapter source + # location has been renamed, the chapter and section menu, + # nodes and cross references are updated to keep consistency + # inside the manual. + texinfo_renameEntryChapter + + elif [[ ${MANUAL_DIRN[$MANUAL_DOCENTRY_ID]} != '' ]] \ + && [[ ${MANUAL_DIRN[(($MANUAL_DOCENTRY_ID + 1))]} != '' ]] ;then + + # When a manual is renamed, a new manual structure is created + # in the manual target location and all chapters and sections + # are duplicated from manual source location to manual target + # location. Once the source manual has been renamed, chapter + # and section menu, nodes and cross references are updated to + # keep consistency inside the manual. + texinfo_renameEntryManual + + else + cli_printMessage "`gettext "The parameters you provided are not supported."`" --as-error-line + fi + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntryChapter.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntryChapter.sh new file mode 100755 index 0000000..f0ab38c --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntryChapter.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# texinfo_renameEntryChapter.sh -- This function standardizes renaming +# tasks related to manual chapters inside documentation manuals +# written in texinfo format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_renameEntryChapter { + + # Copy section source entry to target location. + texinfo_copyEntryChapter + + # Delete section source entry. + texinfo_deleteEntryChapter + + # Rename menu, nodes and cross references related entries. + texinfo_renameCrossReferences + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntryManual.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntryManual.sh new file mode 100755 index 0000000..4a4f7f9 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntryManual.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# texinfo_renameEntryManual.sh -- This function standardizes renaming +# tasks related to documenation manuals written in texinfo format +# inside the working copy. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_renameEntryManual { + + # Copy section source entry to target location. + texinfo_copyEntryManual + + # Delete section source entry. + texinfo_deleteEntryManual + + # Redefine absolute paths to changed directories. This is + # required in order for `cli_commitRepoChanges' to be aware of + # manual source and target locations we've just renamed. + MANUAL_CHANGED_DIRS="${MANUAL_BASEDIR} $(echo $MANUAL_BASEDIR \ + | sed -r "s!${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]}!${MANUAL_DIRN[((${MANUAL_DOCENTRY_ID} + 1))]}!")" + + # From this time on, the manual information set so far is no + # longer useful. Redefine it to start using the new manual + # information instead. + + # Redefine manual name using manual name passed to `centos-art.sh' + # script as second non-option argument. + MANUAL_NAME=${MANUAL_SLFN[((${MANUAL_DOCENTRY_ID} + 1))]} + + # Redefine absolute path to manual directory using manual name + # passed to `centos-art.sh' script as second non-option argument. + MANUAL_BASEDIR="$(echo $MANUAL_BASEDIR \ + | sed -r "s!${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]}!${MANUAL_DIRN[((${MANUAL_DOCENTRY_ID} + 1))]}!")" + + # Redefine absolute path to manual directory using manual name + # passed to `centos-art.sh' script as second non-option argument. + MANUAL_BASEDIR_L10N="${MANUAL_BASEDIR}/${MANUAL_L10N}" + + # Redefine absolute path to base file using manual name passed to + # `centos-art.sh' script as second non-option argument. + MANUAL_BASEFILE="${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}" + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntrySection.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntrySection.sh new file mode 100755 index 0000000..a0694cb --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_renameEntrySection.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# texinfo_renameEntrySection.sh -- This function standardizes renaming +# tasks related to chapter sections inside documentation manuals +# written in texinfo format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_renameEntrySection { + + # Copy section source entry to target location. + texinfo_copyEntrySection + + # Delete section source entry. + texinfo_deleteEntrySection + + # Rename menu, nodes and cross references related entries. + texinfo_renameCrossReferences + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh new file mode 100755 index 0000000..cc7713d --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# +# texinfo_restoreCrossReferences.sh -- This function looks inside +# texinfo source files, from section level on, and restores any cross +# reference related to a documentation entry. This function is used in +# those cases where documentation entries are created/recreated to +# documentation structure. It is a verification that looks for +# matching documentation entries previously defined as removed by +# texinfo_deleteCrossReferences function. The +# texinfo_restoreCrossReferences function relays in the removed +# message format produced by texinfo_deleteCrossReferences +# function, in order to return them back into the link format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_restoreCrossReferences { + + local -a PATTERN + local -a REPLACE + + # Define documentation entry. + local MANUAL_ENTRY="$1" + + # Verify documentation entry. If documentation entry is empty, + # stop script execution with an error message. + if [[ $MANUAL_ENTRY == '' ]];then + cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line + fi + + # Build the node string using entry location. + local NODE="$(texinfo_getEntryNode "$MANUAL_ENTRY")" + + # Define regular expression patterns to match removed message + # format produced by message_removeCrossReferences function. + PATTERN[0]="--- @strong\{`gettext "Removed"`\}\((pxref|xref|ref):(${NODE})\) ---" + PATTERN[1]="^@comment --- `gettext "Removed"`\((\* ${NODE}:(.*)?:(.*)?)\) ---$" + + # Define replacement string to turn removed message back to cross + # reference link. + REPLACE[0]='\@\1{\2}' + REPLACE[1]='\1' + + # Define list of entries to process. + local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR_L10N} \ + --pattern=".+\.${MANUAL_EXTENSION}") + + # Update node-related cross references. The node-related cross + # reference definition, long ones specially, could require more + # than one line to be set. By default, GNU sed does not matches + # newline characters in the pattern space, so we need to make use + # of `label' feature and the `N' command in order to build a + # pattern space that includes the newline character in it. Here we + # use the `a' letter to name the label we use, followed by N + # command to add a newline to the pattern space, the s command to + # make the pattern replacement using the `g' flag to make it + # global and finaly the command `b' to branch label named `a'. + sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${MANUAL_ENTRIES} + + # Update menu-related cross references. Menu-related cross + # references hardly appear in more than one line, so there is no + # need to complicate the replacement command. + sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${MANUAL_ENTRIES} + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_searchIndex.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_searchIndex.sh new file mode 100755 index 0000000..5b1b145 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_searchIndex.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# texinfo_searchIndex.sh -- This function does an index search inside the +# info document. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_searchIndex { + + # Verify manual output files and, if they don't exist, create + # them. + if [[ ! -f ${MANUAL_BASEFILE}.info.bz2 ]];then + texinfo_updateOutputFiles + fi + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line + + # Execute info command to perform an index-search. + /usr/bin/info --index-search="$FLAG_SEARCH" --file=${MANUAL_BASEFILE}.info.bz2 + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_searchNode.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_searchNode.sh new file mode 100755 index 0000000..1004858 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_searchNode.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# texinfo_searchNode.sh -- This function converts the documentation +# entry provided to `centos-art.sh' script command-line into a node +# and tries to read it from the manual's `.info' output file. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_searchNode { + + # Verify documentation entry and, if it doesn't exist, prompt out + # its creation. + if [[ ! -f "$MANUAL_ENTRY" ]];then + texinfo_editEntry + fi + + # Verify manual output files and, if they don't exist, create + # them. + if [[ ! -f ${MANUAL_BASEFILE}.info.bz2 ]];then + texinfo_updateOutputFiles + fi + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line + + # Define manual node that will be read. + local MANUAL_NODE="$(texinfo_getEntryNode "$MANUAL_ENTRY")" + + # Verify manual node that will be read. When the manual name is + # the only value passed as documentation entry, then use the `Top' + # node as manual node to be read. + if [[ $MANUAL_NODE =~ $(texinfo_getEntryNode "$MANUAL_NAME") ]];then + MANUAL_NODE='Top' + fi + + # Use info reader to read the manual node. + info --node="${MANUAL_NODE}" --file="${MANUAL_BASEFILE}.info.bz2" + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateChapterMenu.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateChapterMenu.sh new file mode 100755 index 0000000..e0631c8 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateChapterMenu.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# +# texinfo_updateChapterMenu.sh -- This function updates chapter menu. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateChapterMenu { + + local ACTION=$1 + local MENUCHAPTERS='' + + # Build menu of chapters. The Index node is not included as other + # nodes are. The Index node is defined inside the master texinfo + # file (repository.texinfo) as an included file. To create the final + # .info file correctly, the Index line in the menu should remain, + # even no other node exist. + if [[ -f ${MANUAL_BASEFILE}-menu.${MANUAL_EXTENSION} ]];then + MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.${MANUAL_EXTENSION} \ + | egrep -v "^@(end )?menu$" \ + | egrep -v '^\* (Licenses|Index)::$') + fi + + # Re-defined menu of chapters based on action. + case $ACTION in + + --delete-entry ) + # Remove chapter from menu. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" \ + | egrep -v '^\* '"${MANUAL_CHAPTER_NAME}"'::[[:print:]]*$') + ;; + + --add-entry | * ) + # Update chapter menu using texinfo format. Be sure the + # chapter node itself is not included here, that would + # duplicate it inside the menu definition file which end + # up being a definition error. Take care the way you quote + # egrep's pattern, prevent to end up using the syntax + # `$"..."' which has security risks. + MENUCHAPTERS="$(echo "${MENUCHAPTERS}" \ + | egrep -v '\* '"${MANUAL_CHAPTER_NAME}"'::[[:print:]]*$') + * ${MANUAL_CHAPTER_NAME}::" + ;; + esac + + # Remove opening spaces/tabs and empty line from the menu of + # chapters. Empty lines may occur the first time the menu of + # chapters is created. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ + | egrep -v '^[[:space:]]*$') + + # Organize menu of chapters alphabetically and verify that no + # duplicated line be included on the list. Notice that organizing + # menu this way supresses the idea of putting the last chapter + # created at the end of the list. + #MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sort | uniq) + + # Give format to final menu output. + MENUCHAPTERS="@menu + ${MENUCHAPTERS} + * Licenses:: + * Index:: + @end menu" + + # Remove opening space/tabs from menu's final definition. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ + | egrep -v '^[[:space:]]*$') + + # Dump organized menu of chapters into file. + echo "${MENUCHAPTERS}" > ${MANUAL_BASEFILE}-menu.${MANUAL_EXTENSION} + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateChapterNodes.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateChapterNodes.sh new file mode 100755 index 0000000..06b3acb --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateChapterNodes.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# texinfo_updateChapterNodes.sh -- This function updates nodes of +# chapters based on menu of chapters. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateChapterNodes { + + # Build chapter nodes using entries from chapter menu as + # reference. Don't include `Licenses' or `Index' chapters here. + # These chapters are part of our manual's main defintion file and + # shouldn't be handled as regular chapters. + local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.${MANUAL_EXTENSION} \ + | egrep -v '^@(end )?menu$' | egrep -v '^\* (Licenses|Index)::$'\ + | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \ + | sed -r 's! !_!g') + + # Build list of inclusions from chapter nodes. + local FILENODE=$(\ + for CHAPTERNODE in ${CHAPTERNODES};do + INCL=$(echo ${CHAPTERNODE} \ + | sed -r "s!(${CHAPTERNODE})!\1/chapter\.${MANUAL_EXTENSION}!") + # Output inclusion line using texinfo format. + echo "@include $INCL" + done) + + # Dump organized nodes of chapters into file. + echo "$FILENODE" > ${MANUAL_BASEFILE}-nodes.${MANUAL_EXTENSION} + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileDocbook.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileDocbook.sh new file mode 100755 index 0000000..2ab4a56 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileDocbook.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# texinfo_updateOutputFileDocbook.sh -- This function exports +# documentation manual to DocBook format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateOutputFileDocbook { + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.docbook" --as-response-line + + # Update xml output format. + /usr/bin/makeinfo --docbook --output=${MANUAL_BASEFILE}.docbook \ + ${MANUAL_BASEFILE}.${MANUAL_EXTENSION} --no-warn + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileInfo.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileInfo.sh new file mode 100755 index 0000000..116e3a9 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileInfo.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# texinfo_updateOutputFileInfo.sh -- This function exports +# documentation manual to info format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateOutputFileInfo { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-response-line + + # Update info file. + /usr/bin/makeinfo --output=${MANUAL_BASEFILE}.info \ + --enable-encoding \ + ${MANUAL_BASEFILE}.${MANUAL_EXTENSION} + + # Compress info file. + if [[ $? -eq 0 ]];then + bzip2 -f ${MANUAL_BASEFILE}.info + fi + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFilePdf.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFilePdf.sh new file mode 100755 index 0000000..9d33698 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFilePdf.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# texinfo_updateOutputFilePdf.sh -- This function exports documentation +# manual to PDF format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateOutputFilePdf { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.pdf" --as-response-line + + # Update plaintext output directory. + /usr/bin/texi2pdf --quiet \ + ${MANUAL_BASEFILE}.${MANUAL_EXTENSION} --output=${MANUAL_BASEFILE}.pdf + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFilePlaintext.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFilePlaintext.sh new file mode 100755 index 0000000..27bfb0e --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFilePlaintext.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# texinfo_updateOutputFilePlaintext.sh -- This function exports +# documentation manual to plain-text format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateOutputFilePlaintext { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.txt.bz2" --as-response-line + + # Update plaintext output directory. + /usr/bin/makeinfo --plaintext \ + ${MANUAL_BASEFILE}.${MANUAL_EXTENSION} --output=${MANUAL_BASEFILE}.txt + + # Compress plaintext output file. + if [[ -f ${MANUAL_BASEFILE}.txt ]];then + bzip2 ${MANUAL_BASEFILE}.txt --force + fi + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileXhtml.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileXhtml.sh new file mode 100755 index 0000000..44d5e66 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileXhtml.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# +# texinfo_updateOutputFileXhtml.sh -- This function exports +# documentation manual to HTML format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateOutputFileXhtml { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.xhtml.tar.bz2" --as-response-line + + # Verify initialization files used by texi2html. + cli_checkFiles ${MANUAL_TEMPLATE}/manual-init.pl + cli_checkFiles ${MANUAL_TEMPLATE_L10N}/manual-init.pl + + # Verify transformation files used to modify texi2html output. + cli_checkFiles ${MANUAL_TEMPLATE}/manual.sed + cli_checkFiles ${MANUAL_TEMPLATE_L10N}/manual.sed + + # Redefine manual base file to use just the file base name. + local MANUAL_BASEFILE=$(basename "$MANUAL_BASEFILE") + + # Add manual base directory path into directory stack to make it + # the current working directory. This is done to reduce the path + # information packaged inside `repository.xhtml.tar.bz2' file. + pushd ${MANUAL_BASEDIR_L10N} > /dev/null + + # Clean up directory structure where xhtml files will be stored. + # We don't want to have unused files inside it. + if [[ -d ${MANUAL_NAME}-xhtml ]];then + rm -r ${MANUAL_NAME}-xhtml + fi + + # Prepare directory structure where xhtml files will be stored in. + mkdir ${MANUAL_NAME}-xhtml + + # Add directory where xhtml files will be sotred in into directory + # stack to make it the current working directory. This is required + # in order for include paths to be constructed correctly. + pushd ${MANUAL_NAME}-xhtml > /dev/null + + # Update xhtml files. Use texi2html to export from texinfo file + # format to xhtml using The CentOS Web default visual style. + texi2html --lang=$(cli_getCurrentLocale --langcode-only) \ + --init-file=${MANUAL_TEMPLATE}/manual-init.pl \ + --init-file=${MANUAL_TEMPLATE_L10N}/manual-init.pl \ + --output=${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}-xhtml \ + ${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}.${MANUAL_EXTENSION} + + # Remove directory where xhtml files are stored from directory + # stack. The xhtml files have been already created. + popd > /dev/null + + # Apply xhtml transformations. This transformation cannot be built + # inside the initialization script (repository-init.pl). For example, + # Would it be a possible way to produce different quotation HTML + # outputs from the same texinfo quotation definition? Instead, + # once the HTML code is produced we can take que quotation HTML + # definition plus the first letters inside it and transform the + # structure to a completly different thing that can be handle + # through classed inside CSS definitions. + sed -r -i \ + -f ${MANUAL_TEMPLATE}/manual.sed \ + -f ${MANUAL_TEMPLATE_L10N}/manual.sed \ + ${MANUAL_BASEFILE}-xhtml/*.xhtml + + # Compress directory structure where xhtml files are stored in. + # This compressed version is the one we put under version control. + # The directory used to build the compressed version is left + # unversion for the matter of human revision. + tar -cjf ${MANUAL_BASEFILE}.xhtml.tar.bz2 ${MANUAL_BASEFILE}-xhtml + + # Remove manual base directory from directory stack. + popd > /dev/null + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileXml.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileXml.sh new file mode 100755 index 0000000..3fbe661 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileXml.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# texinfo_updateOutputFileXml.sh -- This function exports documentation +# manual to XML format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateOutputFileXml { + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.xml" --as-response-line + + # Update xml output format. + /usr/bin/makeinfo --xml \ + ${MANUAL_BASEFILE}.${MANUAL_EXTENSION} --output=${MANUAL_BASEFILE}.xml \ + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFiles.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFiles.sh new file mode 100755 index 0000000..97f4472 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFiles.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# texinfo_updateOutputFiles.sh -- This function exports documentation +# manual to different output formats. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateOutputFiles { + + # Verify manual base file. We can update manual outputs only if + # its base file exists. For example, we cannot update manual + # outputs if the manual has been deleted previously. + if [[ ! -a ${MANUAL_BASEFILE}.${MANUAL_EXTENSION} ]];then + return + fi + + # Print separator line. + cli_printMessage "`gettext "Updating output files"`" --as-banner-line + + # Add the working copy root directory to directory stack to make + # path construction correctly. Otherwise, makeinfo may produce + # paths incorrectly. + pushd ${CLI_WRKCOPY} > /dev/null + + texinfo_updateOutputFileInfo + texinfo_updateOutputFileXhtml + texinfo_updateOutputFileXml + texinfo_updateOutputFileDocbook + texinfo_updateOutputFilePdf + texinfo_updateOutputFilePlaintext + + # Remove the working copy root directory from directory stack. + popd > /dev/null + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh new file mode 100755 index 0000000..2e71a5c --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh @@ -0,0 +1,113 @@ +#!/bin/bash +# +# texinfo_updateSectionMenu.sh -- This function updates the section's +# menu definition file of a chapter. If this function is called with +# the '--delete-entry' string as first argument, the menu line related +# to the entry being processed is removed. Otherwise, if this function +# is called with the '--add-entry' string as first argument, the menu +# line related to the entry being processed is added to menu's bottom. +# If no argument is passed to this function, the '--add-entry' action +# is assumed. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateSectionMenu { + + # Specify which action to do with documentation entry inside the + # chapter menu. + local ACTION="$1" + + # Define section order. Through this property you can customize + # the section order inside the manual. Possible arguments to this + # option are `ordered', `reversed', `created'. From these three + # values `created' is used by default (i.e., new menu entries are + # added to menu's bottom as last entry.). Notice that, once + # you've sorted the menu using `ordered' or `reversed' values, it + # is hard to sort the list back to former creation orders. Go + # sorted or not sorted at all. + local MANUAL_SECTION_ORDER=$(cli_getConfigValue "${MANUAL_CONFIG_FILE}" "main" "manual_section_order") + if [[ ! $MANUAL_SECTION_ORDER =~ '^(created|ordered|reversed)$' ]];then + MANUAL_SECTION_ORDER='created' + fi + + # Build node information used inside chapter menu. + local MENUNODE=$(texinfo_getEntryNode "$MANUAL_ENTRY") + + # Define menu entry using texinfo style and node information as + # reference. + local MENULINE="* ${MENUNODE}::" + + # Retrive list of menu entries from chapter menu and exclude + # `@menu', `@end menu' and empty lines from output. + local MENU=$(cat $(dirname ${MANUAL_ENTRY})/chapter-menu.${MANUAL_EXTENSION} \ + | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') + + # Re-defined chapter menu entries based on action provided to this + # function as first positional parameter. + case $ACTION in + + --delete-entry ) + # Remove menu entry from chapter menu. + MENU="$(echo "$MENU" | egrep -v "$MENULINE")" + ;; + + --add-entry | * ) + # Add menu entry to chapter menu list as last entry. + MENU="$(echo "$MENU" | egrep -v "$MENULINE" ) + ${MENULINE}" + ;; + + esac + + # Remove opening spaces/tabs and empty lines from final menu + # entries. + MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g' \ + | egrep -v '^[[:space:]]*$') + + # Sort menu entries based on section order property. + case $MANUAL_SECTION_ORDER in + + 'ordered' ) + MENU="$(echo "$MENU" | sort )" + ;; + + 'reversed' ) + MENU="$(echo "$MENU" | sort -r )" + ;; + + esac + + # Rebuild list of chapter menu entries including '@menu' and '@end + # menu' lines back into chapter menu. + MENU="@menu + $MENU + @end menu" + + # Remove opening spaces/tabs and empty lines from final menu + # structure. + MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g' \ + | egrep -v '^[[:space:]]*$') + + # Dump chapter menu entries back into chapter's menu definition + # file. + echo "$MENU" > $(dirname ${MANUAL_ENTRY})/chapter-menu.${MANUAL_EXTENSION} + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateSectionNodes.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateSectionNodes.sh new file mode 100755 index 0000000..0914c93 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateSectionNodes.sh @@ -0,0 +1,142 @@ +#!/bin/bash +# +# texinfo_updateSectionNodes.sh -- This function updates section's +# nodes definition files using section's menu definition file both +# inside the same chapter. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateSectionNodes { + + # Build list of chapter nodes using entries from chapter menu as + # reference. + local NODES=$(cat $(dirname ${MANUAL_ENTRY})/chapter-menu.${MANUAL_EXTENSION} \ + | sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \ + | egrep -v '^@(end )?menu$' | sed -r 's! !:!g') + + # Build chapter nodes based on chapter menu. + for NODE in $NODES;do + + local NODE=$(echo "${NODE}" | sed -r 's!:! !g') + local INCL=$(echo "${NODE}" | sed -r 's! !/!' | sed -r 's! !-!g' | sed -r 's!/(.+)!/\L\1!').${MANUAL_EXTENSION} + local SECT=$(texinfo_getEntryTitle "$NODE") + local CIND=$(texinfo_getEntryIndex "$NODE") + + # Create texinfo section file using templates, only if the + # section file doesn't exist and hasn't been marked for + # deletion. Otherwise, when the files have been marked for + # deletion, they will be created again from texinfo template + # to working copy and that might create confusion. + if [[ ! -f ${MANUAL_BASEDIR_L10N}/$INCL ]] \ + && [[ $(cli_getRepoStatus ${MANUAL_BASEDIR_L10N}/$INCL) != 'D' ]];then + + # Retrive configuration lines from configuration file. Be + # sure no line begining with `#' or space remain in the + # line. Otherwise, it would be difficult to loop through + # configuration lines. + local CONFLINE='' + local CONFLINES=$(cli_getConfigLines "${MANUAL_CONFIG_FILE}" "templates") + + # Initialize both left hand side and right hand side + # configuration values. + local CONFLHS='' + local CONFRHS='' + + # Initialize absolute path to final texinfo template. + local TEMPLATE='' + + # Define what section template to apply using + # documentation entry absolute path and values provided by + # configuration line. Be sure to break the loop in the + # first match. + for CONFLINE in $CONFLINES;do + + CONFLHS=$(echo $CONFLINE \ + | gawk 'BEGIN{FS="="}; { print $1 }' \ + | sed -r 's![[:space:]]*!!g') + + CONFRHS=$(echo $CONFLINE \ + | gawk 'BEGIN{FS="="}; { print $2 }' \ + | sed -r 's![[:space:]]*!!g' | sed -r 's!^"(.+)"$!\1!') + + if [[ ${MANUAL_BASEDIR_L10N}/${INCL} =~ $CONFRHS ]];then + TEMPLATE="${MANUAL_TEMPLATE_L10N}/${CONFLHS}" + break + fi + + done + + # Verify existence of texinfo template file. If no + # template is found, stop script execution with an error + # message. We cannot continue without it. + cli_checkFiles $TEMPLATE + + # Create documentation entry using texinfo template as + # reference. + svn cp ${TEMPLATE} ${MANUAL_BASEDIR_L10N}/$INCL --quiet + + fi + + # Expand common translation markers in documentation entry. + cli_expandTMarkers "${MANUAL_BASEDIR_L10N}/$INCL" + + # Replace node, section and concept index definitions already + # defined with node, section and concept index translation + # markers. Otherwise, incorrect sectioning may happen. Take + # care with index definitions, more than one index definition + # might be found in the section file but only the first + # concept index entry (i.e., `cindex') will be updated, the + # rest will remain as they are. + sed -i -r \ + -e '/^@node/c@node =NODE=' \ + -e '/^@section/c@section =SECT=' \ + -e '0,/^@cindex/c@cindex =CIND=' \ + "${MANUAL_BASEDIR_L10N}/$INCL" + + # Before expading node, section and concept index, be sure + # that all slash characters (`/') be escaped. Otherwise, they + # might be interpreted as separators and that isn't + # desireable in anyway. + NODE=$(echo "$NODE" | sed -r 's/\//\\\//g') + SECT=$(echo "$SECT" | sed -r 's/\//\\\//g') + CIND=$(echo "$CIND" | sed -r 's/\//\\\//g') + + # Expand node, section and concept index translation + # markers in documentation entry. + sed -i -r \ + -e "s/=NODE=/${NODE}/g" \ + -e "s/=SECT=/${SECT}/g" \ + -e "s/=CIND=/${CIND}/g" \ + "${MANUAL_BASEDIR_L10N}/$INCL" + + # Verify existence of chapter-nodes template file. If no + # chapter-nodes template is found, stop script execution with + # an error message. We cannot continue without it. + cli_checkFiles ${MANUAL_TEMPLATE_L10N}/Chapters/chapter-nodes.${MANUAL_EXTENSION} + + # Expand chapter node inclusion definition. + cat ${MANUAL_TEMPLATE_L10N}/Chapters/chapter-nodes.${MANUAL_EXTENSION} \ + | sed -r "s!=INCL=!${INCL}!g" + + # Dump chapter node definition into manual structure. + done > $(dirname ${MANUAL_ENTRY})/chapter-nodes.${MANUAL_EXTENSION} + +} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateStructureSection.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateStructureSection.sh new file mode 100755 index 0000000..6545524 --- /dev/null +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_updateStructureSection.sh @@ -0,0 +1,140 @@ +#!/bin/bash +# +# texinfo_updateStructureSection.sh -- This function looks for all +# section entry files inside manual's base directory and updates menu, +# nodes and cross references definitions for them all, one at a time. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateStructureSection { + + # Print action message. These actions might consume some time to + # finish. The more section entries the regular expression pattern + # matches, the more time it will take to finish. + cli_printMessage "`gettext "Updating section menus, nodes and cross references"`" --as-banner-line + + local PATTERN='' + local MANUAL_ENTRIES='' + local ACTIONNAM_SECMENU='' + local ACTIONNAM_CROSREF='' + + # Define regular expression pattern used to build the list of + # section entries that will be processed. + if [[ "$1" != '' ]];then + PATTERN="$1" + else + PATTERN="${MANUAL_ENTRY}" + fi + + # Verify the pattern value considering both the chapter and + # section names. This is required when no chapter or section name + # is provided to `centos-art.sh' script, as non-option argument in + # the command-line (e.g., `centos-art help --update-structure'). + if [[ $PATTERN =~ "${MANUAL_NAME}\.${MANUAL_EXTENSION}$" ]] \ + || [[ $PATTERN =~ "chapter\.${MANUAL_EXTENSION}$" ]];then + PATTERN="$(dirname ${MANUAL_ENTRY})/.+\.${MANUAL_EXTENSION}" + fi + + # Define action to perform on menu, nodes and cross references + # definitions. + case "$2" in + + --delete ) + + # Remove menu and node definitions for sections inside + # manual, in order to reflect the changes. + ACTIONNAM_SECMENU='updateSectionMenu --delete-entry' + + # Remove cross reference definitions inside manual + # structure. + ACTIONNAM_CROSREF='deleteCrossReferences' + ;; + + --update | * ) + + # Update menu and node definitions for sections inside + # manual, in order to reflect the changes. + ACTIONNAM_SECMENU='updateSectionMenu --add-entry' + + # Resotre cross reference definitions inside manual + # structure. If a documentation entry has been removed by + # mistake and that mistake is later fixed by adding the + # removed documentation entry back into the manual + # structure, it is necessary to rebuild the missing cross + # reference information inside the manual structure in + # order to reactivate the removed cross refereces, as + # well. + ACTIONNAM_CROSREF='restoreCrossReferences' + ;; + + esac + + # Define list of target entries using find's regular expression + # pattern as reference. Notice that, when we update section + # definition files, the files already exist in the working copy so + # the pattern can be its absolute path without any problem. If the + # pattern is built correctly, it will match the location and so be + # returned to build the list of entries to process. Notice also + # that, when updating, it is possible to use a regular expression + # to match more than one location and build the list of entries + # based on such matching. In this last configuration, let you to + # update menu, nodes and cross references to many section + # definitions (i.e., all those section definition file that match + # the pattern you specified). + MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR_L10N} \ + --pattern="${PATTERN}" | egrep -v "/(${MANUAL_NAME}|chapter)") + + # Verify list of target entries. Assuming is is empty, define + # list of target documentation entries using pattern as reference + # instead. When we delete a section entry from the working copy, + # using find to retrive its path isn't possible because the + # section definition file is removed before executing find and by + # consequence no match is found. This issue provokes no section + # entry to be removed from menu, nodes and cross references. In + # order to solve this, use the pattern value as list of target + # entries. Notice that, in this case, the pattern value must be + # the absolute path to that documentation entry which doesn't + # exist and we want to update menu, nodes and cross references + # information for. + if [[ $MANUAL_ENTRIES == '' ]] && [[ $PATTERN =~ '^[[:alnum:]./_-]+$' ]];then + MANUAL_ENTRIES=${PATTERN} + fi + + # Verify list of target entries. Assumming it is still empty, + # there is nothing else to do here but printing an error message + # describing the fact that no section entry was found to process. + if [[ $MANUAL_ENTRIES == '' ]];then + cli_printMessage "`gettext "No section entry found to process."`" --as-error-line + fi + + # Loop through target documentation entries in order to update the + # documentation structure (e.g., it is not enough with copying + # documentation entry files, it is also needed to update menu, + # nodes and related cross-references). + for MANUAL_ENTRY in ${MANUAL_ENTRIES};do + cli_printMessage "${MANUAL_ENTRY}" --as-response-line + texinfo_${ACTIONNAM_SECMENU} + texinfo_updateSectionNodes + texinfo_makeSeeAlso "${MANUAL_ENTRY}" + texinfo_${ACTIONNAM_CROSREF} "${MANUAL_ENTRY}" + done + +} diff --git a/Scripts/Bash/Functions/Help/help.sh b/Scripts/Bash/Functions/Help/help.sh new file mode 100755 index 0000000..31d43b2 --- /dev/null +++ b/Scripts/Bash/Functions/Help/help.sh @@ -0,0 +1,237 @@ +#!/bin/bash +# +# help.sh -- This function initializes the interface used by +# centos-art.sh script to perform documentation tasks through +# different documentation backends. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help { + + # Initialize action name with an empty value. + local ACTIONNAM='' + + # Initialize search option (`--search'). This option is used to + # look for documentation inside documentation backends. + local FLAG_SEARCH="" + + # Initialize manual's language. + local MANUAL_L10N=$(cli_getCurrentLocale) + + # Initialize manuals's top-level directory. This is the place + # where the manual will be stored in. To provide flexibility, the + # current directory where the `centos-art.sh' script was called + # from is used as manual's top-level directory. Notice that this + # relaxation is required because we need to create/maintain + # manuals both under `trunk/Manuals/' and `branches/Manuals/' + # directories. + local MANUAL_TLDIR=${PWD} + + # Verify manual's top-level directory. To prevent messing the + # things up, we need to restrict the possible locations + # where documentation manuals can be created in the working copy. + # When manual's top-level location is other but the ones + # permitted, use `trunk/Manuals' directory structure as default + # location to store documentation manuals. + if [[ ! $MANUAL_TLDIR =~ "^${CLI_WRKCOPY}/(trunk/Manuals|branches/Manuals/[[:alnum:]-]+)$" ]];then + MANUAL_TLDIR="${CLI_WRKCOPY}/trunk/Manuals" + fi + + # Initialize documentation entries arrays. Arrays defined here + # contain all the information needed to process documentation + # entries (e.g., manual, part, chapter and section). + local -a MANUAL_SLFN + local -a MANUAL_DIRN + local -a MANUAL_PART + local -a MANUAL_CHAP + local -a MANUAL_SECT + + # Initialize documentation entries counter. + local MANUAL_DOCENTRY_COUNT=0 + local MANUAL_DOCENTRY_ID=0 + + # Interpret option arguments passed through the command-line. + help_getOptions + + # Redefine arrays related to documentation entries using + # non-option arguments passed through the command-line. At this + # point all options have been removed from ARGUMENTS and + # non-option arguments remain. Evaluate ARGUMENTS to retrive the + # information related documentation entries from there. + help_getEntries + + # Execute backend-specific documentation tasks for each + # documentation entry specified in the command-line, individually. + # Notice that we've stored all documentation entries passed as + # non-option arguments in array variables in order to process them + # now, one by one. This is particularily useful when we need to + # reach items in the array beyond the current iteration cycle. For + # example, when we perform actions that require source and target + # locations (e.g., copying and renaming): we use the current value + # as source location and the second value in the array as target + # location; both defined from the first iteration cycle. + while [[ $MANUAL_DOCENTRY_ID -lt $MANUAL_DOCENTRY_COUNT ]];do + + # Define name used by manual's main definition file. + MANUAL_NAME=${MANUAL_SLFN[${MANUAL_DOCENTRY_ID}]} + + # Define absolute path to directory holding language-specific + # directories. + MANUAL_BASEDIR="${MANUAL_TLDIR}/${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]}" + + # Define absolute path to directory holding language-specific + # texinfo source files. + MANUAL_BASEDIR_L10N="${MANUAL_BASEDIR}/${MANUAL_L10N}" + + # Define absolute path to changed directories inside the + # manual. For example, when a section entry is edited, copied + # or renamed inside the same manual there is only one + # aboslute path to look for changes, the one holding the + # section entry. However, when an entire manual is renamed, + # there might be two different locations to look changes for, + # the source location deleted and the target location added. + MANUAL_CHANGED_DIRS="${MANUAL_BASEDIR_L10N}" + + # Define absolute path to base file. This is the main file + # name (without extension) we use as reference to build output + # files in different formats (.info, .pdf, .xml, etc.). + MANUAL_BASEFILE="${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}" + + # Define manual's part name. + MANUAL_PART_NAME=${MANUAL_PART[${MANUAL_DOCENTRY_ID}]} + + # Define absolute path to manual's part directory. + MANUAL_PART_DIR="${MANUAL_BASEDIR_L10N}/${MANUAL_PART_NAME}" + + # Define manual's chapter name. + MANUAL_CHAPTER_NAME=${MANUAL_CHAP[${MANUAL_DOCENTRY_ID}]} + + # Define absolute path to chapter's directory. This is the + # place where chapter-specific files are stored in. Be sure no + # extra slash be present in the value (e.g., when the part + # name isn't provided). + MANUAL_CHAPTER_DIR="$(echo ${MANUAL_PART_DIR}/${MANUAL_CHAPTER_NAME} \ + | sed -r 's!/{2,}!/!g' )" + + # Define section name. + MANUAL_SECTION_NAME=${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]} + + # Define absolute path to manual's configuration file. This + # is the file that controls the way template files are applied + # to documentation entries once they have been created as well + # as the style and order used for printing sections. + MANUAL_CONFIG_FILE="${MANUAL_BASEFILE}.conf" + + # Define documentation backend. This information defines the + # kind of source files we work with inside the documentation + # manual as well as the kind of actions required by them to + # perform actions related to document management (e.g., + # creation, edition, deletion, copying, renaming, etc.). + if [[ -f ${MANUAL_CONFIG_FILE} ]];then + + # Retrive documentation backend from configuration file. + MANUAL_BACKEND=$(cli_getConfigValue \ + "${MANUAL_CONFIG_FILE}" "main" "manual_backend") + + # Verify documentation backend. This is required in order + # to prevent malformed values from being used. Be sure + # only supported documentation backends can be provided as + # value to `manual_backend' option inside configuration + # files. + if [[ ! $MANUAL_BACKEND =~ '^(texinfo)$' ]];then + cli_printMessage "`gettext "The documentation backend provided isn't supported."`" --as-error-line + fi + + else + + # When the current documentation manual is being created + # for first time, there's no way to get the documentation + # backend to use in the future manual, but asking the user + # creating it which one to use. + cli_printMessage "`gettext "Select one of the following documentation backends:"`" + MANUAL_BACKEND=$(cli_printMessage "texinfo" --as-selection-line) + + fi + + # Notice that, because we are processing non-option arguments + # one by one, there is no need to sycronize changes or + # initialize functionalities to the same manual time after + # time (assuming all documentation entries passed as + # non-option arguments refer the same manual directory name). + # That would be only necessary when documentation entries + # refer to different manual directory names that could be + # written in different documentation backends. + if [[ ${MANUAL_DOCENTRY_ID} -eq 0 \ + || ( ( ${MANUAL_DOCENTRY_ID} -gt 0 ) && ( \ + ${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]} != ${MANUAL_DIRN[((${MANUAL_DOCENTRY_ID} - 1))]} ) ) ]];then + + # Syncronize changes between repository and working copy. + # At this point, changes in the repository are merged in + # the working copy and changes in the working copy + # committed up to repository. + if [[ -d ${MANUAL_CHANGED_DIRS} ]];then + cli_syncroRepoChanges ${MANUAL_CHANGED_DIRS} + fi + + # Initialize documentation backend functionalities. At + # this point we load all functionalities required into + # `centos-art.sh''s execution environment and make them + # available, this way, to perform backend-specific + # documentation tasks. + cli_exportFunctions "${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}/$(cli_getRepoName \ + ${MANUAL_BACKEND} -d)" "${MANUAL_BACKEND}" + + fi + + # Execute backend-specific documentation tasks. + ${MANUAL_BACKEND} + + # Unset the exported functions before go on with the next + # documentation entry provided as non-option argument to + # `centos-art.sh' script. Different documentation entries may + # be written in different documentation backends. Each + # documentation backend is loaded in order to perform their + # related documentation tasks. Assuming more that one + # documentation entry be passed as non-option argument to + # `centos-art.sh' script and they are written in different + # formats, we might end up loading documentation backend + # functionalities that aren't used in the current + # documentation entry being processed. In that sake, unset + # documentation bakend functionalities when the next + # documentation entry refers to a manual directory different + # to that one being currently processed. + if [[ ${MANUAL_DOCENTRY_ID} -gt 0 \ + && ${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]} != ${MANUAL_DIRN[((${MANUAL_DOCENTRY_ID} + 1))]} ]];then + cli_unsetFunctions "${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}/$(cli_getRepoName \ + ${MANUAL_BACKEND} -d)" "${MANUAL_BACKEND}" + fi + + # Increment documentation entry counter id. + MANUAL_DOCENTRY_ID=$(($MANUAL_DOCENTRY_ID + 1)) + + done + + # Syncronize changes between repository and working copy. At this + # point, changes in the repository are merged in the working copy + # and changes in the working copy committed up to repository. + cli_syncroRepoChanges ${MANUAL_CHANGED_DIRS} + +} diff --git a/Scripts/Bash/Functions/Help/help_getEntries.sh b/Scripts/Bash/Functions/Help/help_getEntries.sh new file mode 100755 index 0000000..a1c0ec8 --- /dev/null +++ b/Scripts/Bash/Functions/Help/help_getEntries.sh @@ -0,0 +1,126 @@ +#!/bin/bash +# +# help_getEntries.sh -- This function interpretes non-option +# arguments passed to `help' functionality through the command-line +# and redefines array variables related to documentation entries. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_getEntries { + + # Initialize manual's documentation entry as an empty value local + # to this function. + local MANUAL_DOCENTRY='' + + # Redefine positional parameters using ARGUMENTS. At this point, + # option arguments have been removed from ARGUMENTS variable and + # only non-option arguments remain in it. + eval set -- "$ARGUMENTS" + + if [[ $@ == '' ]];then + + # Define default documentation entry. This happens when + # non-option arguments aren't provided to centos-art.sh + # script. Default documentation entry defined here points to + # manual's main definition file, so only the manual's self + # name and manual's directory name need to be defined here. + MANUAL_SLFN[${MANUAL_DOCENTRY_COUNT}]='tcar-fs' + MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]='Tcar-fs' + MANUAL_DOCENTRY_COUNT=$(($MANUAL_DOCENTRY_COUNT + 1)) + + else + + # Retrive documentation entries passed to `centos-art.sh' + # script as non-option arguments and store them in array + # variables in order to describe their parts (e.g., manual + # name, chapter name and section name) that way. + # Documentation entries passed as non-opiton arguments must be + # written either in `MANUAL:PART:CHAPTER:SECTION' or + # `path/to/dir' formats in order to be processed correctly + # here. Empty spaces are not permitted. To separate words, use + # the minus sign (e.g., hello-world) or cammel case (e.g., + # HelloWorld). + for MANUAL_DOCENTRY in $@;do + + if [[ ${MANUAL_DOCENTRY} =~ '^([A-Za-z0-9-]+)(:[A-Za-z0-9-]*){0,3}$' ]];then + + # When `MANUAL:PART:CHAPTER:SECTION' is used as format + # to documentation entry, you can specify the manual, + # chapter and section where documentation actions will + # take place on. + + # Manual self name. + MANUAL_SLFN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $1 }') -f \ + | tr '[:upper:]' '[:lower:]') + + # Manual self directory name. + MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $1 }') -d ) + + # Manual part name. + MANUAL_PART[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $2 }') -d ) + + # Manual chapter name. + MANUAL_CHAP[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $3 }') -d ) + + # Manual section name. + MANUAL_SECT[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $4 }') -f ) + + elif [[ ${MANUAL_DOCENTRY} =~ '^(trunk|branches|tags)' ]];then + + # When `path/to/dir' is used as format to + # documentation entry, you cannot specify the manual + # chapter or section where documentation actions will + # take place on. Instead, they are predefined for you + # here. Use this format to document directories inside + # your working copy. + + # Manual's self name. + MANUAL_SLFN[${MANUAL_DOCENTRY_COUNT}]='tcar-fs' + + # Manual's self directory name. + MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]='Tcar-fs' + + # Manual's chapter name. + MANUAL_CHAP[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN { FS="/" }; { if ( NF >= 1 ) print $1 }' ) -d ) + + # Manual's section name. + MANUAL_SECT[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN { FS="/" }; { if ( NF >= 2 ) print $0 }' \ + | cut -d/ -f2- | tr '/' '-') -f ) + + else + cli_printMessage "`gettext "The documentation entry provided isn't supported."`" --as-error-line + fi + + # Increment counting of non-option arguments. + MANUAL_DOCENTRY_COUNT=$(($MANUAL_DOCENTRY_COUNT + 1)) + + done + + fi + +} diff --git a/Scripts/Bash/Functions/Help/help_getOptions.sh b/Scripts/Bash/Functions/Help/help_getOptions.sh new file mode 100755 index 0000000..c76116e --- /dev/null +++ b/Scripts/Bash/Functions/Help/help_getOptions.sh @@ -0,0 +1,122 @@ +#!/bin/bash +# +# help_getOptions.sh -- This function interpretes option arguments +# passed to `help' functionality through the command-line and defines +# action names accordingly. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_getOptions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="quiet,answer-yes,dont-commit-changes,read,search:,edit,update-output,update-structure,copy,delete,rename" + + # Parse arguments using getopt(1) command parser. + cli_parseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Define action to take for each option passed. + while true; do + case "$1" in + + --quiet ) + FLAG_QUIET="true" + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + --answer-yes ) + FLAG_ANSWER="true" + shift 1 + ;; + + --dont-commit-changes ) + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + --search ) + ACTIONNAM="searchIndex" + FLAG_SEARCH="$2" + shift 2 + ;; + + --edit ) + ACTIONNAM="editEntry" + shift 1 + ;; + + --copy ) + ACTIONNAM="copyEntry" + shift 1 + ;; + + --delete ) + ACTIONNAM="deleteEntry" + shift 1 + ;; + + --rename ) + ACTIONNAM="renameEntry" + shift 1 + ;; + + --update-output ) + ACTIONNAM="updateOutputFiles" + shift 1 + ;; + + --update-structure ) + ACTIONNAM="updateStructureSection" + shift 1 + ;; + + --read ) + ACTIONNAM="searchNode" + shift 1 + ;; + + -- ) + # Remove the `--' argument from the list of arguments + # in order for processing non-option arguments + # correctly. At this point all option arguments have + # been processed already but the `--' argument still + # remains to mark ending of option arguments and + # begining of non-option arguments. The `--' argument + # needs to be removed here in order to avoid + # centos-art.sh script to process it as a path inside + # the repository, which obviously is not. + shift 1 + break + ;; + esac + done + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + +} diff --git a/Scripts/Bash/Functions/Locale/locale.sh b/Scripts/Bash/Functions/Locale/locale.sh new file mode 100755 index 0000000..5eb64c7 --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale.sh @@ -0,0 +1,109 @@ +#!/bin/bash +# +# locale.sh -- This function provides internationalization features +# for centos-art.sh script through GNU gettext standard processes. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale { + + # Verify current locale information to avoid English messages from + # being localized to themselves. The English language is used as + # reference to write translatable strings inside the source files. + if [[ $(cli_getCurrentLocale) =~ '^en' ]];then + cli_printMessage "`gettext "The English language cannot be localized to itself."`" --as-error-line + fi + + local ACTIONNAMS='' + local ACTIONNAM='' + local ACTIONVAL='' + + # Initialize machine object flag (`--dont-create-mo'). This flag + # controls whether the centos-art.sh script does create/update + # machine object (MO) files from related portable object (PO) + # files or not. By default, MO files are created. + local FLAG_DONT_CREATE_MO='false' + + # Define localization (l10n) base directory. This is the place + # where all translation messages are organized in. Translation + # messages are organized herein using the same layout of the + # components they represent under the `trunk/Identity', + # `trunk/Manuals' or `trunk/Scripts' directory structures. The + # localization base directory must be used as source location for + # subversion operations (e.g., status, update, commit, etc.). + # Otherwise, it would be difficult to add directory structures + # that have several levels down from the localization base + # directory up to the repository (e.g., it is not possible in + # subversion to add a directory which parent directory hasn't been + # added to the repository previously.). + L10N_BASEDIR="$(cli_getRepoTLDir)/L10n" + + # Interpret arguments and options passed through command-line. + locale_getOptions + + # Redefine positional parameters using ARGUMENTS. At this point, + # option arguments have been removed from ARGUMENTS variable and + # only non-option arguments remain in it. + eval set -- "${ARGUMENTS}" + + # Syncronize changes between repository and working copy. At this + # point, changes in the repository are merged in the working copy + # and changes in the working copy committed up to repository. + cli_syncroRepoChanges "${L10N_BASEDIR}" + + # Loop through non-option arguments passed to centos-art.sh script + # through its command-line. + for ACTIONVAL in "$@";do + + # Sanitate non-option argument to be sure it matches the + # directory convenctions stablished by centos-art.sh script + # against source locations in the working copy. + ACTIONVAL=$(cli_checkRepoDirSource "${ACTIONVAL}") + + # Verify directory passed as non-option argument to be sure it + # supports localization. + if [[ ! $(cli_isLocalized "${ACTIONVAL}") == 'true' ]];then + cli_printMessage "`gettext "The path provided does not support localization."`" --as-error-line + fi + + # Define localization working directory using directory passed + # as non-option argument. The localization working directory + # is the place where POT and PO files are stored inside the + # working copy. + L10N_WORKDIR=$(echo "${ACTIONVAL}" \ + | sed -r -e "s!trunk/(Identity|Scripts|Manuals)!trunk/L10n/\1!")/$(cli_getCurrentLocale) + + # Execute localization actions provided to centos-art.sh + # script through its command-line. Notice that localization + # actions will be executed in the same order they were + # provided in the command-line. + for ACTIONNAM in ${ACTIONNAMS};do + ${ACTIONNAM} + done + + done + + # Syncronize changes between repository and working copy. At this + # point, changes in the repository are merged in the working copy + # and changes in the working copy committed up to repository. + cli_syncroRepoChanges "${L10N_BASEDIR}" + +} diff --git a/Scripts/Bash/Functions/Locale/locale_deleteMessages.sh b/Scripts/Bash/Functions/Locale/locale_deleteMessages.sh new file mode 100755 index 0000000..be98e0a --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_deleteMessages.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# locale_deleteMessages.sh -- This function deletes the source files' +# localization directory from the working copy in conjunction with all +# portable objects and machine objects inside it. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_deleteMessages { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Print action message. + cli_printMessage "$L10N_WORKDIR" --as-deleting-line + + # Verify existence of localization working directory. We cannot + # remove translation files that don't exist. + cli_checkFiles "$L10N_WORKDIR" + + # Delete localization working directory using subversion quietly. + svn del "$L10N_WORKDIR" --quiet + +} diff --git a/Scripts/Bash/Functions/Locale/locale_editMessages.sh b/Scripts/Bash/Functions/Locale/locale_editMessages.sh new file mode 100755 index 0000000..313b832 --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_editMessages.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# +# locale_editMessages.sh -- This function edits portable objects (.po) +# using default text editor. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_editMessages { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + local PO_FILE='' + local PO_FILES='' + + # Prepare localization working directory for receiving translation + # files. + if [[ ! -d ${L10N_WORKDIR} ]];then + + # Print separator line. + cli_printMessage "-" --as-separator-line + + # Output action message. + cli_printMessage "${L10N_WORKDIR}" --as-creating-line + + # Create localization working directory making parent + # directories as needed. Subversion doesn't create directories + # recursively, so we use the system's `mkdir' command and then + # subversion to register the changes. + mkdir -p ${L10N_WORKDIR} + + # Commit changes from working copy to central repository only. + # At this point, changes in the repository are not merged in + # the working copy, but chages in the working copy do are + # committed up to repository. + cli_commitRepoChanges "${L10N_BASEDIR}" + + fi + + # Define list of PO files to process based on paths provided as + # non-option arguments through centos-art.sh script command-line. + if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/(Manuals|Identity/Models)/.*$" ]];then + + # Define list of PO files for XML-based files. + PO_FILES=$(cli_getFilesList ${L10N_WORKDIR} --pattern=".*/messages\.po") + + # Do not create MO files for XML-based files. + FLAG_DONT_CREATE_MO='true' + + elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Scripts$" ]];then + + # Define list of PO files for shell scripts. + PO_FILES=$(cli_getFilesList ${L10N_WORKDIR} --pattern=".*/${TEXTDOMAIN}\.po") + + else + cli_printMessage "`gettext "The path provided does not support localization."`" --as-error-line + fi + + # Loop through list of PO files to process in order to edit them + # one by one using user's default text editor. + for PO_FILE in ${PO_FILES};do + + # Print the file we are editing. + cli_printMessage "${PO_FILE}" --as-updating-line + + # Use default text editor to edit the PO file. + eval ${EDITOR} ${PO_FILE} + + # At this point some changes might be realized inside the PO + # file, so we need to update the related MO files based on + # recently updated PO files here in order for `centos-art.sh' + # script to print out the most up to date revision of + # localized messages. Notice that this is required only if we + # were localizaing shell scripts. + locale_updateMessageBinary ${PO_FILE} + + done + +} diff --git a/Scripts/Bash/Functions/Locale/locale_getOptions.sh b/Scripts/Bash/Functions/Locale/locale_getOptions.sh new file mode 100755 index 0000000..3c232ff --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_getOptions.sh @@ -0,0 +1,119 @@ +#!/bin/bash +# +# locale_getOptions.sh -- This function interprets option parameters +# passed to `locale' functionality and defines action names +# accordingly. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_getOptions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="filter:,quiet,answer-yes,dont-commit-changes,update,edit,delete,dont-create-mo" + + # Parse arguments using getopt(1) command parser. + cli_parseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "${ARGUMENTS}" + + # Look for options passed through command-line. + while true; do + case "$1" in + + --filter ) + FLAG_FILTER="$2" + shift 2 + ;; + + --quiet ) + FLAG_QUIET="true" + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + --answer-yes ) + FLAG_ANSWER="true" + shift 1 + ;; + + --dont-commit-changes ) + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + --update ) + ACTIONNAMS="$ACTIONNAMS locale_updateMessages" + shift 1 + ;; + + --edit ) + ACTIONNAMS="$ACTIONNAMS locale_editMessages" + shift 1 + ;; + + --delete ) + ACTIONNAMS="$ACTIONNAMS locale_deleteMessages" + shift 1 + ;; + + --dont-create-mo ) + FLAG_DONT_CREATE_MO="true" + shift 1 + ;; + + -- ) + # Remove the `--' argument from the list of arguments + # in order for processing non-option arguments + # correctly. At this point all option arguments have + # been processed already but the `--' argument still + # remains to mark ending of option arguments and + # begining of non-option arguments. The `--' argument + # needs to be removed here in order to avoid + # centos-art.sh script to process it as a path inside + # the repository, which obviously is not. + shift 1 + break + ;; + esac + done + + # Verify action names. When no action name is specified, use + # edition as default action name. + if [[ $ACTIONNAMS == '' ]];then + ACTIONNAMS="locale_editMessages" + fi + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Verify non-option arguments passed to command-line. If there + # isn't any, redefine the ARGUMENTS variable to use the current + # location the functionality was called from. + if [[ $ARGUMENTS == '' ]];then + ARGUMENTS=${PWD} + fi + +} diff --git a/Scripts/Bash/Functions/Locale/locale_updateMessageBinary.sh b/Scripts/Bash/Functions/Locale/locale_updateMessageBinary.sh new file mode 100755 index 0000000..4b593ee --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_updateMessageBinary.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# +# locale_updateMessageBinary.sh -- This function creates/updates +# machine objects (.mo) from portable objects (.po). +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessageBinary { + + # Verify machine object creation flag. + if [[ ${FLAG_DONT_CREATE_MO} == 'true' ]];then + return + fi + + # Define absolute path to portable object file. + local PO_FILE="$1" + + # Verify existence of portable object file. + cli_checkFiles "${PO_FILE}" + + # Define absolute path to machine object directory. + local MO_DIR="${L10N_WORKDIR}/LC_MESSAGES" + + # Define absolute path to machine object file. + local MO_FILE="${MO_DIR}/${CLI_PROGRAM}.sh.mo" + + # Print action message. + cli_printMessage "${MO_FILE}" --as-creating-line + + # Verify absolute path to machine object directory, if it doesn't + # exist create it. + if [[ ! -d ${MO_DIR} ]];then + mkdir -p ${MO_DIR} + fi + + # Create machine object from portable object. + msgfmt --check ${PO_FILE} --output-file=${MO_FILE} + +} diff --git a/Scripts/Bash/Functions/Locale/locale_updateMessageMetadata.sh b/Scripts/Bash/Functions/Locale/locale_updateMessageMetadata.sh new file mode 100755 index 0000000..2ed19e0 --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_updateMessageMetadata.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# +# locale_updateMessageMetadata.sh -- This function sanitates .pot and +# .po files to use common translation markers inside top comment. +# Later, replacement of common translation markers is applied to set +# the final information. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessageMetadata { + + local COUNT=0 + local -a SRC + local -a DST + + # Retrive absolute path of portable object we'll work with. + local FILE="$1" + + # Define current locale. + local CURRENTLOCALE=$(cli_getCurrentLocale) + + # Define language name from current locale. + local LANGNAME=$(cli_getLangName ${CURRENTLOCALE}) + + # Check existence of file before work with it. + cli_checkFiles "${FILE}" + + # Define pattern lines. The pattern lines are put inside portable + # objects through xgettext and xml2po commands . + SRC[0]="\"Project-Id-Version:" + SRC[1]="\"Report-Msgid-Bugs-To:" + SRC[2]="\"Last-Translator:" + SRC[3]="\"Language-Team:" + SRC[4]="\"PO-Revision-Date:" + + # Define replacement lines for pattern line. + DST[0]="\"Project-Id-Version: ${CLI_PROGRAM}.sh\\\n\"" + DST[1]="\"Report-Msgid-Bugs-To: The CentOS L10n SIG <=MAIL_L10N=>\\\n\"" + DST[2]="\"Last-Translator: The CentOS L10n SIG <=MAIL_L10N=>\\\n\"" + DST[3]="\"Language-Team: ${LANGNAME}\\\n\"" + DST[4]="\"PO-Revision-Date: $(date "+%F %H:%M%z")\\\n\"" + + # Change pattern lines with their replacement lines. + while [[ $COUNT -lt ${#SRC[*]} ]];do + sed -i -r "/${SRC[$COUNT]}/c${DST[$COUNT]}" ${FILE} + COUNT=$(($COUNT + 1)) + done + + # When the .pot file is created using xml2po the + # `Report-Msgid-Bugs-To:' metadata field isn't created like it + # does when xgettext is used. So, in order to have such metadata + # field in all .pot files, verify its existence and add it if it + # doesn't exist. + egrep "^\"${SRC[1]}" $FILE > /dev/null + if [[ $? -ne 0 ]];then + sed -i -r "/^\"${SRC[0]}/a${DST[1]}" $FILE + fi + + # Replace package information using gettext domain information. + sed -i -r "s/PACKAGE/${TEXTDOMAIN}/g" ${FILE} + + # Expand translation markers inside file. + cli_expandTMarkers ${FILE} + + # Unset array variables to avoid undesired concatenations. + unset SRC + unset DST + +} diff --git a/Scripts/Bash/Functions/Locale/locale_updateMessagePObjects.sh b/Scripts/Bash/Functions/Locale/locale_updateMessagePObjects.sh new file mode 100755 index 0000000..416b5e2 --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_updateMessagePObjects.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# locale_updateMessagePObjects.sh -- This function initializes the +# portable object when it doesn't exist. When the portable object does +# exist, it is updated instead. In both cases, the portable object +# template is used as source to merge changes inside the portable +# object. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessagePObjects { + + local FILE="$1" + + # Verify the portable object template. The portable object + # template is used to create the portable object. We cannot + # continue without it. + cli_checkFiles "${FILE}.pot" + + # Print action message. + cli_printMessage "${FILE}.po" --as-creating-line + + # Verify existence of portable object. The portable object is the + # file translators edit in order to make translation works. + if [[ -f ${FILE}.po ]];then + + # Update portable object merging both portable object and + # portable object template. + msgmerge --output="${FILE}.po" "${FILE}.po" "${FILE}.pot" --quiet + + else + + # Initiate portable object using portable object template. + # Do not print msginit sterr output, use centos-art action + # message instead. + msginit -i ${FILE}.pot -o ${FILE}.po --width=70 \ + --no-translator 2> /dev/null + + fi + + # Sanitate metadata inside the PO file. + locale_updateMessageMetadata "${FILE}.po" + +} diff --git a/Scripts/Bash/Functions/Locale/locale_updateMessageShell.sh b/Scripts/Bash/Functions/Locale/locale_updateMessageShell.sh new file mode 100755 index 0000000..5d671c7 --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_updateMessageShell.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# +# locale_updateMessageShell.sh -- This function parses shell scripts +# source files under action value and retrives translatable strings in +# order to creates/updates both the portable object template (.pot) +# and the portable object (.po) related. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessageShell { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Define absolute path to file used as reference to create + # portable object templates (.pot), portable objects (.po) and + # machine objects (.mo). + local MESSAGES="${L10N_WORKDIR}/${TEXTDOMAIN}" + + # Define regular expression to match extensions of shell scripts + # we use inside the repository. + local EXTENSION='sh' + + # Build list of files to process. When building the patter, be + # sure the value passed through `--filter' be exactly evaluated + # with the extension as prefix. Otherwise it would be difficult to + # match files that share the same characters in their file names + # (e.g., it would be difficult to match only `hello.sh' if + # `hello-world.sh' also exists in the same location). + local FILES=$(cli_getFilesList ${ACTIONVAL} --pattern="${FLAG_FILTER}\.${EXTENSION}") + + # Print action message. + cli_printMessage "${MESSAGES}.pot" --as-updating-line + + # Retrive translatable strings from shell script files and create + # the portable object template (.pot) from them. + xgettext --output=${MESSAGES}.pot \ + --copyright-holder="The CentOS L10n SIG" \ + --width=70 --sort-by-file ${FILES} + + # Sanitate metadata inside the POT file. + locale_updateMessageMetadata "${MESSAGES}.pot" + + # Verify, initialize or update portable objects from portable + # object templates. + locale_updateMessagePObjects "${MESSAGES}" + +} diff --git a/Scripts/Bash/Functions/Locale/locale_updateMessageXml.sh b/Scripts/Bash/Functions/Locale/locale_updateMessageXml.sh new file mode 100755 index 0000000..f3a72bf --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_updateMessageXml.sh @@ -0,0 +1,112 @@ +#!/bin/bash +# +# locale_updateMessageXml.sh -- This function parses XML-based files +# (e.g., scalable vector graphics), retrives translatable strings and +# creates/update gettext portable objects. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessageXml { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Define filename used to create both portable object templates + # (.pot) and portable objects (.po) files. + local MESSAGES="${L10N_WORKDIR}/messages" + + # Define regular expression to match the file extension of all + # XML-based source files that can be localized inside the working + # copy. Be aware that sometimes, source files and output files + # are stored in the same location (e.g., when rendering + # `tcar-ug.docbook' file the `tcar-ug.xhtml' is saved in the same + # location). Avoid using output files as if they were source + # files, when retriving translatable strings. + local EXTENSION='(svg|docbook)' + + # Build list of files to process. When building the patter, be + # sure the value passed through `--filter' be exactly evaluated + # with the extension as prefix. Otherwise it would be difficult to + # match files that share the same characters in their file names + # (e.g., it would be difficult to match only `hello.docbook' if + # `hello-world.docbook' also exists in the same location). + local FILES=$(cli_getFilesList ${ACTIONVAL} \ + --pattern="${FLAG_FILTER}\.${EXTENSION}" \ + --maxdepth='1' --type="f" \ + | egrep -v '/[[:alpha:]]{2}_[[:alpha:]]{2}/') + + # Print action message. + cli_printMessage "${MESSAGES}.pot" --as-updating-line + + # Normalize XML files, expand entities before retriving + # translatable strings and create the portable object template + # (.pot) from such output. The translatable strings are retrived + # from the normalized output of files, not files themselves + # (because of this, we don't include `#: filename:line' output on + # .pot files). Entity expansion is also necessary for DocBook + # documents to be processed correctly. Notice that some long + # DocBook document structures might use entities to split the + # document structure into smaller pieces so they could be easier + # to maintain. Also, don't validate svg files the same way you + # validate docbook files; Docbook files have a DOCTYPE definition + # while svg files don't. Without a DOCTYPE definition, it isn't + # possible for `xmllint' to validate the document. + if [[ $ACTIONVAL =~ '^.+/(branches|trunk)/Manuals/.+$' ]];then + + # Another issue to consider is the amount of source files that + # are being processed through xml2po. When there are more than + # one file, xml2po interprets only the first one and discards + # the rest in the list. This way, when more than one file + # exists in the list, it isn't convenient to provide xmllint's + # output to xml2po's input. Once here, we can say that + # in order to expand DocBook entities it is required that only + # one file must be provided at localization time (e.g., using + # the `--filter' option). Otherwise translation messages are + # retrived from all files, but no entity expansion is realized + # because xmllint wouldn't be used in such case. + if [[ $(echo "$FILES" | wc -l) -eq 1 ]];then + + xmllint --valid --noent ${FILES} | xml2po -a - \ + | msgcat --output=${MESSAGES}.pot --width=70 --no-location - + + else + + xml2po -a ${FILES} \ + | msgcat --output=${MESSAGES}.pot --width=70 --no-location - + + fi + + elif [[ $ACTIONVAL =~ '^.+/(branches|trunk)/Identity/Models/.+$' ]];then + + xml2po -a ${FILES} \ + | msgcat --output=${MESSAGES}.pot --width=70 --no-location - + + else + + cli_printMessage "`gettext "The path provided doesn't support localization."`" --as-error-line + + fi + + # Verify, initialize or merge portable objects from portable object + # templates. + locale_updateMessagePObjects "${MESSAGES}" + +} diff --git a/Scripts/Bash/Functions/Locale/locale_updateMessages.sh b/Scripts/Bash/Functions/Locale/locale_updateMessages.sh new file mode 100755 index 0000000..742888d --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_updateMessages.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# locale_updateMessages.sh -- This function extracts translatable +# strings from both XML-based files (using xml2po) and shell scripts +# (using xgettext). Translatable strings are initially stored in +# portable objects templates (.pot) which are later merged into +# portable objects (.po) in order to be optionally converted as +# machine objects (.mo). +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessages { + + # Verify existence of localization working directory. We cannot + # update translation files that don't exist. + cli_checkFiles $L10N_WORKDIR + + local ACTIONNAM='' + + # Evaluate action value to determine whether to use xml2po to + # extract translatable strings from XML-based files or to use + # xgettext to extract translatable strings from shell script + # files. + if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/(Manuals|Identity/Models)/.*$" ]];then + + # Update translatable strings inside the portable object + # template related to XML-based files (e.g., scalable vector + # graphics). + locale_updateMessageXml + + elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Scripts$" ]];then + + # Update translatable strings inside the portable object + # template related to shell scripts (e.g., the centos-art.sh + # script). + locale_updateMessageShell + + else + cli_printMessage "`gettext "The path provided doesn't support localization."`" --as-error-line + fi + +} diff --git a/Scripts/Bash/Functions/Prepare/Config/vim.conf b/Scripts/Bash/Functions/Prepare/Config/vim.conf new file mode 100755 index 0000000..5737ebd --- /dev/null +++ b/Scripts/Bash/Functions/Prepare/Config/vim.conf @@ -0,0 +1,8 @@ +set nu +set textwidth=70 +set autoindent +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab +set tags=./tags,tags diff --git a/Scripts/Bash/Functions/Prepare/prepare.sh b/Scripts/Bash/Functions/Prepare/prepare.sh new file mode 100755 index 0000000..140ca5d --- /dev/null +++ b/Scripts/Bash/Functions/Prepare/prepare.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# prepare.sh (initialization) -- This function creates the base +# execution environment required to standardize final configuration +# stuff needed by your workstation, once the working copy of The +# CentOS Artwork Repository has been downloaded in it. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare { + + local ACTIONNAM='' + local ACTIONNAMS='' + + # Define absolute path to directory holding prepare's + # configuration files. + local PREPARE_CONFIG_DIR=${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}/Config + + # Interpret arguments and options passed through command-line. + prepare_getOptions + + # Execute action names based on whether they were provided or not. + if [[ $ACTIONNAMS == '' ]];then + + # When action names are not provided, define action names that + # will take place, explicitly. + prepare_updatePackages + prepare_updateLinks + prepare_updateImages + prepare_updateManuals + + else + + # When action names are provided, loop through them and + # execute them one by one. + for ACTIONNAM in $ACTIONNAMS;do + ${ACTIONNAM} + done + + fi + +} diff --git a/Scripts/Bash/Functions/Prepare/prepare_getEnvars.sh b/Scripts/Bash/Functions/Prepare/prepare_getEnvars.sh new file mode 100755 index 0000000..8a3198a --- /dev/null +++ b/Scripts/Bash/Functions/Prepare/prepare_getEnvars.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# +# prepare_getEnvars.sh -- This function outputs a brief description of +# relevant environment variables used by `centos-art.sh' script. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_getEnvars { + + local -a VARS + local -a INFO + local COUNT=0 + + # Define name of environment variables used by centos-art.sh + # script. + VARS[0]='EDITOR' + VARS[1]='TZ' + VARS[2]='TEXTDOMAIN' + VARS[3]='TEXTDOMAINDIR' + VARS[4]='LANG' + + # Define description of environment variables. + INFO[0]="`gettext "Default text editor"`" + INFO[1]="`gettext "Default time zone representation"`" + INFO[2]="`gettext "Default domain used to retrieve translated messages"`" + INFO[3]="`gettext "Default directory used to retrive translated messages"`" + INFO[4]="`gettext "Default locale information"`" + + until [[ $COUNT -eq ${#VARS[*]} ]];do + + # Let user to reduce output using regular expression as + # reference. + if [[ ${VARS[$COUNT]} =~ $FLAG_FILTER ]];then + + # Output list of environment variables using indirect + # expansion (what a beautiful feature!) to output variable + # value. + cli_printMessage "${INFO[$COUNT]}:" + cli_printMessage "${VARS[$COUNT]}=${!VARS[$COUNT]}" --as-response-line + + fi + + # Increment counter. + COUNT=$(($COUNT + 1)) + + done + +} diff --git a/Scripts/Bash/Functions/Prepare/prepare_getLinkName.sh b/Scripts/Bash/Functions/Prepare/prepare_getLinkName.sh new file mode 100755 index 0000000..83ab48a --- /dev/null +++ b/Scripts/Bash/Functions/Prepare/prepare_getLinkName.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# +# prepare_getLinkName.sh -- This function standardizes link name +# construction. For the construction sake, two arguments are required, +# one to now the file's base directory, and another holding the file's +# absolute path. With this information, the base directory is removed +# from file's absolute path and the remaining path is transformed into +# a file name where each slash is converted into minus sign. +# +# For example, if the following information is provided: +# +# ARG1: /home/centos/artwork/trunk/Identity/Brushes +# ARG2: /home/centos/artwork/trunk/Identity/Brushes/Corporate/symbol.gbr +# +# the result will be: `corporate-symbol.gbr'. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_getLinkName { + + local LINK_BASEDIR='' + local LINK_ABSPATH='' + local LINK_CHARSEP='' + + # Define absolute path to link's base directory. + LINK_BASEDIR="$1" + + # Define absolute path to link's file. + LINK_ABSPATH="$2" + + # Define character used as word separator on file name. + LINK_CHARSEP='-' + + # Output link name. + echo "$LINK_ABSPATH" | sed -r "s!^${LINK_BASEDIR}/!!" \ + | tr '[:upper:]' '[:lower:]' | sed -r "s!/!${LINK_CHARSEP}!g" + +} diff --git a/Scripts/Bash/Functions/Prepare/prepare_getOptions.sh b/Scripts/Bash/Functions/Prepare/prepare_getOptions.sh new file mode 100755 index 0000000..c6da090 --- /dev/null +++ b/Scripts/Bash/Functions/Prepare/prepare_getOptions.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# +# prepare_getOptions.sh -- This function parses command options +# provided to `centos-art.sh' script when the first argument in the +# command-line is the `prepare' word. To parse options, this function +# makes use of getopt program. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_getOptions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="quiet,answer-yes,packages,links,images,manuals,environment" + + # Parse arguments using getopt(1) command parser. + cli_parseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + case "$1" in + + --quiet ) + FLAG_QUIET="true" + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + --answer-yes ) + FLAG_ANSWER="true" + shift 1 + ;; + + --packages ) + ACTIONNAMS="${ACTIONNAMS} prepare_updatePackages" + shift 1 + ;; + + --links ) + ACTIONNAMS="${ACTIONNAMS} prepare_updateLinks" + shift 1 + ;; + + --images ) + ACTIONNAMS="${ACTIONNAMS} prepare_updateImages" + shift 1 + ;; + + --manuals ) + ACTIONNAMS="${ACTIONNAMS} prepare_updateManuals" + shift 1 + ;; + + --environment ) + ACTIONNAMS="${ACTIONNAMS} prepare_getEnvars" + shift 1 + ;; + + * ) + break + esac + done + +} diff --git a/Scripts/Bash/Functions/Prepare/prepare_updateImages.sh b/Scripts/Bash/Functions/Prepare/prepare_updateImages.sh new file mode 100755 index 0000000..ca8aa54 --- /dev/null +++ b/Scripts/Bash/Functions/Prepare/prepare_updateImages.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# prepare_updateImages.sh -- This option initializes image files inside +# the working copy. When you provide this option, the centos-art.sh +# scripts renders image files from all design models available in the +# working copy. This step is required in order to satisfy dependencies +# from different components inside the working copy. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_updateImages { + + # Define list of directories that need to be rendered. + local DIRS=$(cli_getFilesList \ + ${CLI_WRKCOPY}/trunk/Identity/Images --maxdepth="1" \ + --mindepth="1" --type="d" --pattern=".+/[[:alnum:]]+$") + + # Execute the render functionality of centos-art.sh script to + # produce directories inside the list one by one. Producing + # directories one by one is important because themes directory is + # produced differently compared to others directories. This way, + # when we create a list of directories and pass them that way to + # centos-art.sh script, it is possible for ir to know how to + # produce each directory passed. + ${CLI_BASEDIR}/${CLI_PROGRAM}.sh render $DIRS --dont-commit-changes + +} diff --git a/Scripts/Bash/Functions/Prepare/prepare_updateLinks.sh b/Scripts/Bash/Functions/Prepare/prepare_updateLinks.sh new file mode 100755 index 0000000..c3f9134 --- /dev/null +++ b/Scripts/Bash/Functions/Prepare/prepare_updateLinks.sh @@ -0,0 +1,139 @@ +#!/bin/bash +# +# prepare_updateLinks.sh -- This option creates/updates the symbolic links +# information required in your workstation to connect it with the +# files inside the working copy of The CentOS Artwork Repository. When +# you provide this option, the centos-art.sh put itself into your +# system's execution path and make common brushes, patterns, palettes +# and fonts available inside applications like GIMP, so you can make +# use of them without loosing version control over them. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_updateLinks { + + local -a LINKS_SRC + local -a LINKS_DST + local USERFILES='' + local PALETTE='' + local BRUSH='' + local PATTERN='' + local FONT='' + local FILE='' + local COUNT=0 + + # Define user's directories. This is the place where configuration + # links are created in. + local GIMP_DIR=${HOME}/.$(rpm -q gimp | cut -d. -f-2) + local GIMP_DIR_BRUSHES=${GIMP_DIR}/brushes + local GIMP_DIR_PALETTES=${GIMP_DIR}/palettes + local GIMP_DIR_PATTERNS=${GIMP_DIR}/patterns + local INKS_DIR=${HOME}/.inkscape + local INKS_DIR_PALETTES=${INKS_DIR}/palettes + local FONT_DIR=${HOME}/.fonts + local APPS_DIR=${HOME}/bin + + # Define working copy directories. This is the place where + # configuration links point to. + local WCDIR=$(cli_getRepoTLDir)/Identity + local WCDIR_BRUSHES=${WCDIR}/Brushes + local WCDIR_PALETTES=${WCDIR}/Palettes + local WCDIR_PATTERNS=${WCDIR}/Patterns + local WCDIR_FONTS=${WCDIR}/Fonts + local WCDIR_EDITOR=${PREPARE_CONFIG_DIR} + + # Define link relation for cli. + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${APPS_DIR}/${CLI_PROGRAM} + LINKS_DST[((++${#LINKS_DST[*]}))]=${CLI_BASEDIR}/${CLI_PROGRAM}.sh + USERFILES="${APPS_DIR}/${CLI_PROGRAM}" + + # Define link relation for fonts. + for FONT in $(cli_getFilesList "${WCDIR_FONTS}" --pattern='.+\.ttf');do + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${FONT_DIR}/$(basename $FONT) + LINKS_DST[((++${#LINKS_DST[*]}))]=${FONT} + done + + # Define link relation for common palettes. + for PALETTE in $(cli_getFilesList "${WCDIR_PALETTES}" --pattern=".+\.gpl");do + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_PALETTES}/$(prepare_getLinkName ${WCDIR_PALETTES} ${PALETTE}) + LINKS_DST[((++${#LINKS_DST[*]}))]=${PALETTE} + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${INKS_DIR_PALETTES}/$(prepare_getLinkName ${WCDIR_PALETTES} ${PALETTE}) + LINKS_DST[((++${#LINKS_DST[*]}))]=${PALETTE} + done + + # Define link relation for common brushes. + for BRUSH in $(cli_getFilesList "${WCDIR_BRUSHES}" --pattern=".+\.(gbr|gih)");do + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_BRUSHES}/$(prepare_getLinkName ${WCDIR_BRUSHES} ${BRUSH}) + LINKS_DST[((++${#LINKS_DST[*]}))]=${BRUSH} + done + + # Define link relation for common patterns. + for PATTERN in $(cli_getFilesList "${WCDIR_PATTERNS}" --pattern=".+\.png");do + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_PATTERNS}/$(prepare_getLinkName ${WCDIR_BRUSHES} ${BRUSH}) + LINKS_DST[((++${#LINKS_DST[*]}))]=${PATTERN} + done + + # Define link relation for Vim text editor's configuration. + if [[ $EDITOR == '/usr/bin/vim' ]];then + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${HOME}/.vimrc + LINKS_DST[((++${#LINKS_DST[*]}))]=${WCDIR_EDITOR}/vim.conf + USERFILES="${USERFILES} ${HOME}/.vimrc" + fi + + # Define which files inside the user's configuration directories + # need to be removed in order for centos-art.sh script to make a + # fresh installation of common patterns, common palettes and + # common brushes using symbolic links from the working copy to the + # user's configuration directories inside the workstation. + USERFILES=$(echo "$USERFILES"; + cli_getFilesList ${APPS_DIR} --pattern='.+\.sh'; + cli_getFilesList ${FONT_DIR} --pattern='.+\.ttf'; + cli_getFilesList ${GIMP_DIR_BRUSHES} --pattern='.+\.(gbr|gih)'; + cli_getFilesList ${GIMP_DIR_PATTERNS} --pattern='.+\.(pat|png|jpg|bmp)'; + cli_getFilesList ${GIMP_DIR_PALETTES} --pattern='.+\.gpl'; + cli_getFilesList ${INKS_DIR_PALETTES} --pattern='.+\.gpl';) + + # Remove user-specific configuration files from user's home + # directory. Otherwise, we might end up having links insid user's + # home directory that don't exist inside the working copy. + if [[ "$USERFILES" != '' ]];then + rm -r $USERFILES + fi + + while [[ $COUNT -lt ${#LINKS_SRC[*]} ]];do + + # Print action message. + cli_printMessage "${LINKS_SRC[$COUNT]}" --as-creating-line + + # Create symbolic link's parent directory if it doesn't exist. + if [[ ! -d $(dirname ${LINKS_SRC[$COUNT]}) ]];then + mkdir -p $(dirname ${LINKS_SRC[$COUNT]}) + fi + + # Create symbolic link. + ln ${LINKS_DST[$COUNT]} ${LINKS_SRC[$COUNT]} --symbolic --force + + # Increment counter. + COUNT=$(($COUNT + 1)) + + done + +} diff --git a/Scripts/Bash/Functions/Prepare/prepare_updateManuals.sh b/Scripts/Bash/Functions/Prepare/prepare_updateManuals.sh new file mode 100755 index 0000000..bde6e8c --- /dev/null +++ b/Scripts/Bash/Functions/Prepare/prepare_updateManuals.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# prepare_updateManuals.sh -- This option initializes documentation files +# inside the working copy. When you provide this option, the +# centos-art.sh script renders all documentation manuals from their +# related source files so you can read them nicely. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_updateManuals { + + local RELEASE=$(cat /etc/redhat-release | gawk '{ print $3 }') + + # The CentOS Artwork Repository User's Guide in docbook format. + ${CLI_BASEDIR}/${CLI_PROGRAM}.sh render \ + trunk/Manuals/Tcar-ug --filter="tcar-ug" \ + --dont-commit-changes + + # The CentOS Distribution Notes + ${CLI_BASEDIR}/${CLI_PROGRAM}.sh render \ + trunk/Manuals/Distro --releasever="${RELEASE}" \ + --dont-commit-changes + + # The CentOS Artwork Repository User's Guide in texinfo format. + ${CLI_BASEDIR}/${CLI_PROGRAM}.sh help --update \ + trunk/Manuals/Tcar-fs \ + --dont-commit-changes + +} diff --git a/Scripts/Bash/Functions/Prepare/prepare_updatePackages.sh b/Scripts/Bash/Functions/Prepare/prepare_updatePackages.sh new file mode 100755 index 0000000..6a75928 --- /dev/null +++ b/Scripts/Bash/Functions/Prepare/prepare_updatePackages.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# +# prepare_updatePackages.sh -- This function verifies the required +# packages your workstation needs to have installed in order for +# `centos-art.sh' script to run correctly. If there is one or more +# missing packages, the `centos-art.sh' script asks you to confirm +# their installation through `sudo yum'. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_updatePackages { + + local PACKAGE='' + local PACKAGES='' + local PACKAGES_THIRDS='' + local -a PACKAGES_MISSING + local -a PACKAGES_INSTALL + local RPM='/bin/rpm' + local YUM='/usr/bin/yum' + local YUM_OPTIONS='' + + # Check execution rights of package managers. + cli_checkFiles $RPM --execution + cli_checkFiles $YUM --execution + + # Define required packages needed by centos-art.sh script. + PACKAGES="inkscape ImageMagick netpbm netpbm-progs syslinux gimp + coreutils texinfo info tetex-latex tetex-fonts tetex-xdvi + tetex-dvips gettext texi2html gnome-doc-utils elinks + docbook-style-xsl docbook-utils docbook-dtds + docbook-style-dsssl docbook-simple docbook-utils-pdf + docbook-slides firefox sudo yum rpm ctags" + + # Define packages from third party repositories (i.e., packages + # not included in CentOS [base] repository.) required by + # centos-art to work as expected. + PACKAGES_THIRDS="(inkscape|blender)" + + # Build list of installed and missing packages. + for PACKAGE in $PACKAGES;do + $RPM -q --queryformat "%{NAME}\n" $PACKAGE --quiet + if [[ $? -ne 0 ]];then + PACKAGES_MISSING[((++${#PACKAGES_MISSING[*]}))]=$PACKAGE + else + PACKAGES_INSTALL[((++${#PACKAGES_INSTALL[*]}))]=$PACKAGE + fi + done + + # Define relation between centos-art.sh options and yum options. + [[ $FLAG_ANSWER == 'true' ]] && YUM_OPTIONS="${YUM_OPTIONS} -y" + [[ $FLAG_QUIET == 'true' ]] && YUM_OPTIONS="${YUM_OPTIONS} -q" + + # Use `sudo yum' to install missing packages in your workstation. + if [[ ${#PACKAGES_MISSING[*]} -gt 0 ]];then + sudo ${YUM} ${YUM_OPTIONS} install ${PACKAGES_MISSING[*]} + fi + + # Use `sudo yum' to update installed packages in your workstation. + if [[ ${#PACKAGES_INSTALL[*]} -gt 0 ]];then + sudo ${YUM} ${YUM_OPTIONS} update ${PACKAGES_INSTALL[*]} + fi + +} diff --git a/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2fo.xsl b/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2fo.xsl new file mode 100755 index 0000000..6eac1da --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2fo.xsl @@ -0,0 +1,6 @@ + + + + diff --git a/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2pdf.dsl b/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2pdf.dsl new file mode 100644 index 0000000..407a604 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2pdf.dsl @@ -0,0 +1,464 @@ + + +]]> +]> + + + + + + +;;====================================== +;;General Options +;;====================================== + +;;Do you want to print on both sides of the paper? +(define %two-side% + #t) + +;;Do you want enumerated sections? (E.g, 1.1, 1.1.1, 1.2, etc.) +(define %section-autolabel% + #t) + +;;Show URL links? If the text of the link and the URL are identical, +;;the parenthetical URL is suppressed. +(define %show-ulinks% + #t) + +;Make Ulinks footnotes to stop bleeding in the edges - this increases +;'jade --> print' time tremendously keep this in mind before +;complaining! +(define %footnote-ulinks% + #t) + +;;Tex Backend on +(define tex-backend + #t) + +;;Define Line Spacing +(define %line-spacing-factor% 1.3) + +;;Define the Paragraph Style +(define para-style + (style + font-size: %bf-size% + font-weight: 'medium + font-posture: 'upright + font-family-name: %body-font-family% + line-spacing: (* %bf-size% %line-spacing-factor%))) + +(define ($object-titles-after$) + (list (normalize "figure"))) + +;;====================================== +;;Book Options +;;====================================== + + +;;Do you want a title page for a Book? +(define %generate-book-titlepage% + #t) + +;;Do you want a separate page for the title? +(define %generate-book-titlepage-on-separate-page% + #t) + +;;Generate Book TOC? +(define %generate-book-toc% + #t) + +;;What depth should the TOC generate? +;;!Only top level of appendixes! +(define (toc-depth nd) + (if (string=? (gi nd) (normalize "book")) + 3 + (if (string=? (gi nd) (normalize "appendix")) + 0 + 1))) + +;;Do you want a TOC for the element part? +(define %generate-part-toc% + #t) + +;;Do you want the part toc on the part titlepage or separate? +(define %generate-part-toc-on-titlepage% + #t) + +;;Generate Part Title Page? +(define %generate-part-titlepage% + #t) + +;;Do you want the Part intro on the part title page? +(define %generate-partintro-on-titlepage% + #t) + +;;What elements should have a LOT? +(define ($generate-book-lot-list$) + (list (normalize "equation"))) + +;;Do you want chapters enumerated? +(define %chapter-autolabel% + #t) + +;;Do you want Chapter's and Appendix's +;;to have automatic labels? +(define %chap-app-running-head-autolabel% + #t) + +;;====================================== +;;Article Options +;;====================================== + +;;Do you want a title page for an Article? +(define %generate-article-titlepage% + #t) + +;;Generate Article TOC? +(define %generate-article-toc% + #t) + +;;Do you want a separate page for the title? +(define %generate-article-titlepage-on-separate-page% + #t) + +;;Do you want the article toc on the titlepage or separate? +(define %generate-article-toc-on-titlepage% + #t) + +;;Do you want to start new page numbers with each article? +(define %article-page-number-restart% + #f) + +;;Titlepage Separate? +(define (chunk-skip-first-element-list) + '()) + +;;Titlepage Not Separate +;(define (chunk-skip-first-element-list) +; (list (normalize "sect1") +; (normalize "section"))) + +;;====================================== +;;Columns +;;====================================== + +;;How many columns do you want? +(define %page-n-columns% + 1) + +;;How much space between columns? +(define %page-column-sep% + 0.2in) + +;;How many Columns on the titlepage? +(define %titlepage-n-columns% + 1) + +;;Balance columns? +(define %page-balance-colums% + #t) + +;;====================================== +;;Fonts +;;====================================== + +;;Defines the general size of the text in the document. normal(10), +;;presbyopic(12), and large-type(24). +(define %visual-acuity% + "presbyopic") + +;;What font would you like for titles? +(define %title-font-family% + "Helvetica") + +;;What font would you like for the body? +(define %body-font-family% + "Palatino") + +;;What font would you like for mono-seq? +(define %mono-font-family% + "Courier New") + +;;If the base fontsize is 10pt, and '%hsize-bump-factor%' is +;; 1.2, hsize 1 is 12pt, hsize 2 is 14.4pt, hsize 3 is 17.28pt, etc +(define %hsize-bump-factor% + 1.1) + +;;What size do you want the body fonts? +(define %bf-size% + (case %visual-acuity% + (("tiny") 8pt) + (("normal") 10pt) + (("presbyopic") 12pt) + (("large-type") 24pt))) + +(define-unit em %bf-size%) + +;;====================================== +;;Margins +;;====================================== + +(define %left-right-margin% 6pi) + +;;How much indentation for the body? +(define %body-start-indent% + 0pi) + +;;How big is the left margin? (relative to physical page) +(define %left-margin% + 8pi) ;white-paper-column + +;;How big is the right margin? (relative to physical page) +(define %right-margin% + 8pi) ;white-paper-column + +;;How big do you want the margin at the top? +(define %top-margin% + (if (equal? %visual-acuity% "large-type") + 7.5pi + 8pi)) + +;;How big do you want the margin at the bottom? +(define %bottom-margin% + (if (equal? %visual-acuity% "large-type") + 7.5pi + 8pi)) + +;;Define the text width. (Change the elements in the formula rather +;;than the formula itself) +;(define %text-width% (- %page-width% (* %left-right-margin% 2))) +(define %text-width% (- %page-width% (+ %left-margin% %right-margin%))) + +;;Define the body width. (Change the elements in the formula rather +;;than the formula itself) +(define %body-width% + (- %text-width% %body-start-indent%)) + +;;Define distance between paragraphs +(define %para-sep% + (/ %bf-size% 1.0)) + +;;Define distance between block elements (figures, tables, etc.). +(define %block-sep% + (* %para-sep% 1.0)) + +;;Indent block elements? +(define %block-start-indent% + 0pt) +;0pt + +;;====================================== +;;Admon Graphics +;;====================================== + +;;Do you want admon graohics on? +(define %admon-graphics% + #f) + +;;Where are the admon graphics? +(define %admon-graphics-path% + "../images/") + +;;====================================== +;;Quadding +;;====================================== + +;;What quadding do you want by default; start, center, justify, or end? +(define %default-quadding% + 'justify) + +;;What quadding for component titles(Chapter, Appendix, etc)? +(define %component-title-quadding% + 'start) + +;;What quadding for section titles? +(define %section-title-quadding% + 'start) + +;;What quadding for section sub-titles? +(define %section-subtitle-quadding% + 'start) + +;;What quadding for article title? +(define %article-title-quadding% + 'center) + +;;What quadding for article sub-titles? +(define %article-subtitle-quadding% + 'center) + +;;What quadding for division subtitles? +(define %division-subtitle-quadding% + 'start) + +;;What quadding for component subtitles? +(define %component-subtitle-quadding% + 'start) + +;;====================================== +;;Paper Options +;;====================================== + +;;What size paper do you need? A4, USletter, USlandscape, or RedHat? +(define %paper-type% + "USletter") + +;;Now define those paper types' width +(define %page-width% + (case %paper-type% + (("A4") 210mm) + (("USletter") 8.5in) + (("USlandscape") 11in))) + +;;Now define those paper types' height +(define %page-height% + (case %paper-type% + (("A4") 297mm) + (("USletter") 11in) + (("USlandscape") 8.5in))) + +;;====================================== +;;Functions +;;====================================== + +(define (OLSTEP) + (case + (modulo (length (hierarchical-number-recursive "ORDEREDLIST")) 4) + ((1) 1.2em) + ((2) 1.2em) + ((3) 1.6em) + ((0) 1.4em))) + +(define (ILSTEP) 1.0em) + +(define (PROCSTEP ilvl) + (if (> ilvl 1) 1.8em 1.4em)) + +(define (PROCWID ilvl) + (if (> ilvl 1) 1.8em 1.4em)) + +(define ($comptitle$) + (make paragraph + font-family-name: %title-font-family% + font-weight: 'bold + font-size: (HSIZE 2) + line-spacing: (* (HSIZE 2) %line-spacing-factor%) + space-before: (* (HSIZE 2) %head-before-factor%) + space-after: (* (HSIZE 2) %head-after-factor%) + start-indent: 0pt + first-line-start-indent: 0pt + quadding: 'start + keep-with-next?: #t + (process-children-trim))) + +;;Callouts are confusing in Postscript... fix them. +(define %callout-fancy-bug% + #f) + +;;By default perils are centered and dropped into a box with a really +;;big border - I have simply decreased the border thickness - +;;unfortunately it takes all this to do it - sigh. +(define ($peril$) + (let* ((title (select-elements + (children (current-node)) (normalize "title"))) + (has-title (not (node-list-empty? title))) + (adm-title (if has-title + (make sequence + (with-mode title-sosofo-mode + (process-node-list (node-list-first title)))) + (literal + (gentext-element-name + (current-node))))) + (hs (HSIZE 2))) + (if %admon-graphics% + ($graphical-admonition$) + (make display-group + space-before: %block-sep% + space-after: %block-sep% + font-family-name: %admon-font-family% + font-size: (- %bf-size% 1pt) + font-weight: 'medium + font-posture: 'upright + line-spacing: (* (- %bf-size% 1pt) %line-spacing-factor%) + (make box + display?: #t + box-type: 'border + line-thickness: .5pt + start-indent: (+ (inherited-start-indent) (* 2 (ILSTEP)) 2pt) + end-indent: (inherited-end-indent) + (make paragraph + space-before: %para-sep% + space-after: %para-sep% + start-indent: 1em + end-indent: 1em + font-family-name: %title-font-family% + font-weight: 'bold + font-size: hs + line-spacing: (* hs %line-spacing-factor%) + quadding: 'center + keep-with-next?: #t + adm-title) + (process-children)))))) + +;;====================================== +;;Non-printing Elements +;;====================================== +(element TITLEABBREV (empty-sosofo)) +(element SUBTITLE (empty-sosofo)) +(element SETINFO (empty-sosofo)) +(element BOOKINFO (empty-sosofo)) +(element BIBLIOENTRY (empty-sosofo)) +(element BIBLIOMISC (empty-sosofo)) +(element BOOKBIBLIO (empty-sosofo)) +(element SERIESINFO (empty-sosofo)) +(element DOCINFO (empty-sosofo)) +(element ARTHEADER (empty-sosofo)) +;;(element ADDRESS (empty-sosofo)) + +;;Show comment element? +(define %show-comments% + #t) + +;;====================================== +;;Formalpara titles +;;====================================== + +;;Change the way Formal Paragraph titles are displayed. The commented +;;out section will run the titles in the paragraphs. +(element (formalpara title) + ;(make sequence + ;font-weight: 'bold + ;($runinhead$)) + ($lowtitle$ 5 7)) + +;;====================================== +;;Inlines +;;====================================== + +(element application ($mono-seq$)) +(element command ($bold-seq$)) +(element filename ($mono-seq$)) +(element function ($mono-seq$)) +(element guibutton ($bold-seq$)) +(element guiicon ($bold-seq$)) +(element guilabel ($italic-seq$)) +(element guimenu ($bold-seq$)) +(element guimenuitem ($bold-seq$)) +(element hardware ($bold-mono-seq$)) +(element keycap ($bold-seq$)) +(element literal ($mono-seq$)) +(element parameter ($italic-mono-seq$)) +(element prompt ($mono-seq$)) +(element symbol ($charseq$)) +(element emphasis ($italic-seq$)) + + + + + + + diff --git a/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2xhtml-chunks.xsl b/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2xhtml-chunks.xsl new file mode 100755 index 0000000..9c99ade --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2xhtml-chunks.xsl @@ -0,0 +1,7 @@ + + + + + diff --git a/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2xhtml-common.xsl b/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2xhtml-common.xsl new file mode 100755 index 0000000..619b0d2 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2xhtml-common.xsl @@ -0,0 +1,10 @@ + + +=REPO_HOME=/trunk/Identity/Webenv/Css/Docbook/default.css + + + +=REPO_HOME=/trunk/Identity/Images/Webenv/ + diff --git a/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2xhtml-single.xsl b/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2xhtml-single.xsl new file mode 100755 index 0000000..271e624 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/Styles/docbook2xhtml-single.xsl @@ -0,0 +1,7 @@ + + + + + diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook.sh b/Scripts/Bash/Functions/Render/Docbook/docbook.sh new file mode 100755 index 0000000..e776abc --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/docbook.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# docbook.sh -- This function performs base-rendition actions for +# DocBook files. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function docbook { + + # Initialize absolute path to Xsl directory. This is the location + # where customization of XSL tranformations are stored in. + DOCBOOK_STYLES_DIR="${RENDER_BACKEND_DIR}/Docbook/Styles" + + docbook_convertToXhtmlChunk + docbook_convertToXhtml + + # WARNING: There are some issues related to DocBook-to-PDF + # transformations that make the whole process not so "clean" as + # DocBook-to-XHTML transformation is. Based on this situation and + # the need of providing a clean output, PDF transformation is + # commented until these issues be corrected. If you have a release + # of CentOS greater than 5.5, uncomment this to see what happen. + #docbook_convertToPdf + + # Perform backend post-rendition. + docbook_doPostActions + + # Perform backend last-rendition. + docbook_doLastActions + +} diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdf.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdf.sh new file mode 100755 index 0000000..1f4497c --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdf.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# docbook_convertToPdf.sh -- This function takes DocBook XML as input +# and produces two different PDF as outputs; one from DocBook XML and +# another from DocBook SGML. We decided to provide support for both +# ways of output production from DocBook XML and DocBook SGML for you +# to evaluate and if possible correct. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function docbook_convertToPdf { + + # Tranform DocBook XML to PDF. + docbook_convertToPdfFromXml + + # Tranform DocBook SGML to PDF. + if [[ $(cli_getCurrentLocale) =~ '^en' ]];then + # FIXME: This is only possible when no localization is + # performed (i.e., xml2po is not involved.) to main DocBook + # file, otherwise there will be errors and the PDF output + # won't be created. The errors come out because when we passed + # the validated DocBook file to xml2po all XML decimal + # entities inside the main DocBook file are expanded and set + # in the msgid field. Such expanded characters are not + # recognized by openjade when they are used as source to + # produce the PDF output. + docbook_convertToPdfFromSgml + fi + +} diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdfFromSgml.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdfFromSgml.sh new file mode 100755 index 0000000..0417f47 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdfFromSgml.sh @@ -0,0 +1,116 @@ +#!/bin/bash +# +# docbook_convertToPdfFromSgml.sh -- This function transforms DocBook +# files which have set the SGML DTD in them. To produce PDF from +# DocBook SGML DTD, we take the DocBook XML DTD file and change its +# DTD from XML to SGML. Since XML is SGML shoudn't be any problem. +# Once the DTD has been changed from XML to SGML, we use openjade +# (through `jw' shell script) to convert the SGML-based DocBook file +# to PDF. Customization can be achieved through DSL +# (docbook-style-dsssl-1.79-4.1) shipped in this distribution. +# +# In this configuration and using default configuration settings, I've +# presented the following problems: +# +# 1. It is not possible to produce localized PDF outputs through +# `xml2po', the default way of producing localized content inside +# `centos-art.sh' script. +# +# In this configuration and using default configuration settins, I've +# presented the following advantages: +# +# 1. The PDF output produced from SGML-based files seem to be better +# looking an less buggy than PDF output produced from XML-based +# files, visually I mean. +# +# To make the whole process transparent, a temporal directory is +# created for intermediate works and final files are moved then to +# their final location. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function docbook_convertToPdfFromSgml { + + # Print action message. + if [[ -f ${FILE}.sgml.pdf ]];then + cli_printMessage "${FILE}.sgml.pdf" --as-updating-line + else + cli_printMessage "${FILE}.sgml.pdf" --as-creating-line + fi + + local -a STYLE_TEMPLATE + local -a STYLE_INSTANCE + local STYLE_INSTANCE_FINAL='' + + # Define name of temporal directory where the DocBook to PDF + # transformation will take place. + local TMPDIR=$(cli_getTemporalFile "docbook2pdf") + + # Define absolute path to DocBook source file. This is the + # repository documentation manual file where DOCTYPE and ENTITY + # definition lines are set. + local SRC=${INSTANCE} + + # Define absolute path to PDF target file. This is the final + # location the PDF file produced as result of DocBook to PDF + # transformation will be stored in. + local DST="${FILE}.sgml.pdf" + + # Define file name of PDF file. This is the file we were looking + # for and the one moved, once produced. + local PDF=$(basename ${SRC} | sed -r 's!\.docbook$!.pdf!') + + # Replace document definition from XML to SGML. + sed -i -r \ + -e 's!"-//OASIS//DTD DocBook XML!"-//OASIS//DTD DocBook!' \ + -e 's!"http://www\.oasis-open\.org/docbook/xml/([[:digit:]])\.([[:digit:]])/docbookx\.dtd"!"docbook/sgml-dtd-\1.\2-1.0-30.1/docbook.dtd"!' \ + $SRC + + # Prepare style final instance used in transformations. + docbook_prepareStyles "${DOCBOOK_STYLES_DIR}/docbook2pdf.dsl" + + # Verify temporal directory and create it if doesn't exist. + if [[ ! -d $TMPDIR ]];then + mkdir $TMPDIR + fi + + # Move inside temporal directory. + pushd $TMPDIR > /dev/null + + # Create PDF format. + docbook2pdf --dsl ${STYLE_INSTANCE_FINAL} ${SRC} &> /dev/null + + # Verify `docbook2pdf' exit status and, if everything is ok, move + # PDF file from temporal directory to its target location. + if [[ $? -eq 0 ]];then + mv $PDF $DST + else + cli_printMessage "`gettext "Cannot produce the PDF file."`" --as-error-line + fi + + # Return to where we initially were. + popd > /dev/null + + # Remove temporal directory and temporal style instances created. + rm -r $TMPDIR + rm ${STYLE_INSTANCE[*]} + +} diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdfFromXml.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdfFromXml.sh new file mode 100755 index 0000000..b327857 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdfFromXml.sh @@ -0,0 +1,138 @@ +#!/bin/bash +# +# docbook_convertToPdfFromXml.sh -- This function transforms DocBook +# files which have set the XML DTD in them. To produce PDF from +# DocBook XML DTD, we need an XSLT engine (e.g., through `xsltproc' +# command) to produce formatting objects (FO), which then must be +# processed with an FO engine (e.g., through `pdfxmltex' command, +# which uses PassiveTex) to produce the PDF output. +# +# In this configuration and using default configuration settings, I've +# presented the following problems: +# +# 1. Something is wrong with headings. They are not expanded along +# the whole page-body. They seem to be rendered in a reduced width +# (1 inch approximatly). This provokes the heading to be broken in a +# two-to-five letters column and sometimes it overlaps the +# sectioning titles (e.g., chatper, section). I tried to customize +# the value of `header.column.widths' and `page.margin.top' but it +# seems to be not there where I need to touch. +# +# 2. TOC's indentation is not rendered. Even the `toc.indent.width' +# property is set to 24 by default. +# +# 3. Inside lists, when items are more than one line, the +# indentation seems to work for the first line only. All other +# lines in the same item are not indented and begin completly +# unaligned. +# +# 4. Long file paths near the end of page-body aren't hyphenated. +# Even the `hyphenate' property is set to `true' by default. +# +# In this configuration and using default configuration settings, I've +# presented the following advantages: +# +# 1. It is possible to produce localized PDF outputs through +# `xml2po', the default way of producing localized content inside +# the `centos-art.sh' script. +# +# To make the whole process transparent, a temporal directory is +# created for intermediate works and final files are moved then to +# their final location. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function docbook_convertToPdfFromXml { + + # Print action message. + if [[ -f ${FILE}.sgml.pdf ]];then + cli_printMessage "${FILE}.xml.pdf" --as-updating-line + else + cli_printMessage "${FILE}.xml.pdf" --as-creating-line + fi + + local -a STYLE_TEMPLATE + local -a STYLE_INSTANCE + local STYLE_INSTANCE_FINAL='' + + # Define name of temporal directory where the DocBook to PDF + # transformation will take place. + local TMPDIR=$(cli_getTemporalFile "docbook2pdf") + + # Define absolute path to DocBook source file. This is the + # repository documentation manual file where DOCTYPE and ENTITY + # definition lines are set. + local SRC=${INSTANCE} + + # Define absolute path to PDF target file. This is the final + # location the PDF file produced as result of DocBook to PDF + # transformation will be stored in. + local DST="${FILE}.xml.pdf" + + # Define file name of formatting object (.fo) file. This file is + # an intermediate file needed to produced the PDF. + local FO=$(basename ${FILE}).fo + + # Define file name of PDF file. This is the file we were looking + # for and the one moved, once produced. + local PDF=$(basename ${FILE}).pdf + + # Prepare XSL final instances used in transformations. + docbook_prepareStyles "${DOCBOOK_STYLES_DIR}/docbook2fo.xsl" + + # Verify temporal directory and create it if doesn't exist. + if [[ ! -d $TMPDIR ]];then + mkdir $TMPDIR + fi + + # Move inside temporal directory. + pushd $TMPDIR > /dev/null + + # Create formatting object supressing output from stderr. + xsltproc --output ${FO} ${STYLE_INSTANCE_FINAL} ${SRC} &> /dev/null + + # Create PDF format from formatting object. The `pdfxmltex' + # command (which use the `PassiveTex' engine) must be executed + # twice in order for the document's cross references to be built + # correctly. + if [[ $? -eq 0 ]];then + pdfxmltex ${FO} > /dev/null + pdfxmltex ${FO} > /dev/null + else + cli_printMessage "`gettext "Cannot produce the formatting object."`" --as-error-line + fi + + # Verify `pdfxmltex' exit status and, if everything is ok, move + # PDF file from temporal directory to its target location. + if [[ $? -eq 0 ]];then + mv $PDF $DST + else + cli_printMessage "`gettext "Cannot produce the PDF file."`" --as-error-line + fi + + # Return to where we initially were. + popd > /dev/null + + # Remove temporal directory and temporal style instances created. + rm -r $TMPDIR + rm ${STYLE_INSTANCE[*]} + +} diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_convertToText.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToText.sh new file mode 100755 index 0000000..e1c86f7 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToText.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# svg_convertToText.sh -- This function takes the XHTML file produced +# by docbook_convertToXhtml and produces one plain-text file (i.e., +# without markup inside). +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function docbook_convertToText { + + # Verify existence of HTML file. If `.xhtml' file doesn't exist + # don't create text file. The `.xhtml' file is required in order + # to create the `.txt' file. + if [[ ! -f ${FILE}.xhtml ]];then + return + fi + + local COMMAND='' + local OPTIONS='' + + # Define the command path to text-based web browser and options + # used to produce plain-text files. Most of these programs have a + # dump option that print formatted plain-text versions of given + # HTML file to stdout. + if [[ -x '/usr/bin/lynx' ]];then + COMMAND='/usr/bin/lynx' + OPTIONS='-force_html -nolist -width 70 -dump' + elif [[ -x '/usr/bin/elinks' ]];then + COMMAND='/usr/bin/elinks' + OPTIONS='-force_html -no-numbering -no-references -width 70 -dump' + elif [[ -x '/usr/bin/w3m' ]];then + COMMAND='/usr/bin/w3m' + OPTIONS='-dump' + fi + + if [[ $COMMAND != '' ]];then + + # Print action message. + if [[ -f ${FILE}.txt ]];then + cli_printMessage "${FILE}.txt" --as-updating-line + else + cli_printMessage "${FILE}.txt" --as-creating-line + fi + + # Convert from HTML to plain-text without markup. + ${COMMAND} ${OPTIONS} ${FILE}.xhtml > ${FILE}.txt + + else + cli_printMessage "`gettext "No way to convert from XHTML to plain-text found."`" --as-error-line + fi + +} diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_convertToXhtml.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToXhtml.sh new file mode 100755 index 0000000..3d02c15 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToXhtml.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# docbook_convertToXhtml.sh -- This function uses DocBook XML as input +# and applies XSL stylesheets to produce a big XHTML files as output. +# The procedure was taken from the documentation of +# `docbook-style-xsl-1.69.1-5.1' package, which says: ---To publish +# HTML from your XML documents, you just need an XSL engine.---. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function docbook_convertToXhtml { + + local -a STYLE_TEMPLATE + local -a STYLE_INSTANCE + local STYLE_INSTANCE_FINAL='' + + # Print action message. + if [[ -f ${FILE}.xhtml ]];then + cli_printMessage "${FILE}.xhtml" --as-updating-line + else + cli_printMessage "${FILE}.xhtml" --as-creating-line + fi + + # Define absolute path to DocBook source file. This is the + # repository documentation manual file where DOCTYPE and ENTITY + # definition lines are set. + local SRC=${INSTANCE} + + # Define absolute path to PDF target file. This is the final + # location the PDF file produced as result of DocBook to PDF + # transformation will be stored in. + local DST="${FILE}.xhtml" + + # Prepare XSL final instances used in transformations. + docbook_prepareStyles $(cli_getFilesList \ + ${DOCBOOK_STYLES_DIR} --pattern='.*docbook2xhtml-(single|common)\.xsl') + + # Transform DocBook XML to XHTML supressing all stderr output. + xsltproc --output ${DST} ${STYLE_INSTANCE_FINAL} ${SRC} &> /dev/null + + # Remove XSL instance files. + rm ${STYLE_INSTANCE[*]} + +} diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_convertToXhtmlChunk.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToXhtmlChunk.sh new file mode 100755 index 0000000..fe2c8fe --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToXhtmlChunk.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# +# docbook_convertToXhtmlChunk.sh -- This function uses DocBook XML as +# input and applies XSL stylesheets to produce a directory with many +# XHTML files as output. The procedure was taken from the +# documentation of `docbook-style-xsl-1.69.1-5.1' package, which says: +# ---To publish HTML from your XML documents, you just need an XSLT +# engine.---. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function docbook_convertToXhtmlChunk { + + local -a STYLE_TEMPLATE + local -a STYLE_INSTANCE + local STYLE_INSTANCE_FINAL='' + + # Define absolute path to PDF target file. This is the final + # location the PDF file produced as result of DocBook to PDF + # transformation will be stored in. + local DST="${FILE}-xhtml/" + + # Clean up output directory. This is required in order to prevent + # old files from remaining therein when they are no longer needed. + if [[ -d ${DST} ]];then + rm -r "${DST}" + fi + mkdir ${DST} + + # Print action message. + cli_printMessage "${FILE}-xhtml" --as-creating-line + + # Define absolute path to DocBook source file. This is the + # repository documentation manual file where DOCTYPE and ENTITY + # definition lines are set. + local SRC=${INSTANCE} + + # Prepare XSL final instances used in transformations. + docbook_prepareStyles $(cli_getFilesList \ + ${DOCBOOK_STYLES_DIR} --pattern='.*docbook2xhtml-(chunks|common)\.xsl') + + # Transform DocBook XML to XHTML supressing all stderr output. + xsltproc --output ${DST} ${STYLE_INSTANCE_FINAL} ${SRC} &> /dev/null + + # Remove XSL instance files. + rm ${STYLE_INSTANCE[*]} + +} diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_doLastActions.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_doLastActions.sh new file mode 100755 index 0000000..7009fec --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/docbook_doLastActions.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# docbook_doLastActions.sh -- This function performs last-rendition +# actions for DocBook files. These are the actions that take +# base-rendition and post-rendition output as input to produce output +# from it. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function docbook_doLastActions { + + # Presently, there is no last-rendition action for DocBook base + # rendition but the function should exist for consistency with + # other backends. + return + +} diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_doPostActions.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_doPostActions.sh new file mode 100755 index 0000000..d858b60 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/docbook_doPostActions.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# docbook_doPostActions.sh -- This function performs post-rendition +# actions for DocBook files. These are the actions that take +# base-rendition output as input to producing output from it. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function docbook_doPostActions { + + docbook_convertToText + +} diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_prepareStyles.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_prepareStyles.sh new file mode 100755 index 0000000..6a5f955 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Docbook/docbook_prepareStyles.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# +# docbook_prepareStyles.sh -- This function prepares styles' final +# instances used in transformations based on XSL or DSL templates. +# There are translation markers inside the XSL and DSL templates that +# need to be expand before they be used for transformations. This +# function creates temporal instances of XSL and DSL templates with +# translation markers expanded inside so as for transformation +# commands (e.g., `xmltproc' or `openjade' through `docbook2pdf') to +# use as style defintion. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function docbook_prepareStyles { + + local STYLE_TEMPLATE_FILE='' + local STYLE_TEMPLATE_FILES=$@ + local STYLE_INSTANCE_COMMON='' + local COUNT=0 + + for STYLE_TEMPLATE_FILE in $STYLE_TEMPLATE_FILES;do + + STYLE_TEMPLATE[((++${#STYLE_TEMPLATE[*]}))]="${STYLE_TEMPLATE_FILE}" + STYLE_INSTANCE[((++${#STYLE_INSTANCE[*]}))]="$(cli_getTemporalFile ${STYLE_TEMPLATE_FILE})" + + # Keep track of array's real index value. Remember, it starts + # at zero but counting starts at 1 instead. So, substracting 1 + # from counting we have the real index value we need to work + # with the information stored in the array. + COUNT=$(( ${#STYLE_INSTANCE[*]} - 1 )) + + # Create style instance from style template. + cp ${STYLE_TEMPLATE[$COUNT]} ${STYLE_INSTANCE[$COUNT]} + + # Define both final an common style instances based on style + # templates. + if [[ $STYLE_TEMPLATE_FILE =~ 'docbook2fo\.xsl$' ]];then + STYLE_INSTANCE_FINAL=${STYLE_INSTANCE[$COUNT]} + elif [[ $STYLE_TEMPLATE_FILE =~ 'docbook2pdf\.dsl$' ]];then + STYLE_INSTANCE_FINAL=${STYLE_INSTANCE[${COUNT}]} + elif [[ $STYLE_TEMPLATE_FILE =~ 'docbook2xhtml-(chunks|single)\.xsl$' ]];then + STYLE_INSTANCE_FINAL=${STYLE_INSTANCE[${COUNT}]} + elif [[ $STYLE_TEMPLATE_FILE =~ 'docbook2xhtml-common\.xsl$' ]];then + STYLE_INSTANCE_COMMON=${STYLE_INSTANCE[${COUNT}]} + fi + + done + + # Verify style final instance. This is the file used by + # transformation command (`xsltproc' or `openjade') to produce the + # specified output. We cannot continue without it. + cli_checkFiles $STYLE_INSTANCE_FINAL + + # Expand common translation markers in the common style instance, + # if it exists. + if [[ -f $STYLE_INSTANCE_COMMON ]];then + cli_expandTMarkers $STYLE_INSTANCE_COMMON + fi + + # Expand specific translation markers in final style instance. + sed -r -i "s!=STYLE_XHTML_COMMON=!${STYLE_INSTANCE_COMMON}!" ${STYLE_INSTANCE_FINAL} + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg.sh b/Scripts/Bash/Functions/Render/Svg/svg.sh new file mode 100755 index 0000000..0419479 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# svg.sh -- This function performs base-rendition action for SVG +# files. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg { + + # Initialize the export id used inside design templates. This + # value defines the design area we want to export. + local EXPORTID='CENTOSARTWORK' + + # Verify the export id. + svg_checkModelExportId "$INSTANCE" "$EXPORTID" + + # Check existence of external files. Inside design templates and + # their instances, external files are used to refere the + # background information required by the design template. If such + # background information is not available the image is produced + # without background information. This is something that need to + # be avoided. + svg_checkModelAbsref "$INSTANCE" + + # Render template instance using inkscape and save the output. + local INKSCAPE_OUTPUT="$(\ + inkscape $INSTANCE --export-id=$EXPORTID --export-png=${FILE}.png)" + + # Modify output from inkscape to fit the centos-art.sh script + # output visual style. + cli_printMessage "$(echo "$INKSCAPE_OUTPUT" | egrep '^Area' \ + | sed -r "s!^Area!`gettext "Area"`:!")" + cli_printMessage "$(echo "$INKSCAPE_OUTPUT" | egrep '^Background' \ + | sed -r "s!^Background (RRGGBBAA):(.*)!`gettext "Background"`: \1 \2!")" + cli_printMessage "$(echo "$INKSCAPE_OUTPUT" | egrep '^Bitmap saved as' \ + | sed -r "s!^Bitmap saved as:!`gettext "Saved as"`:!")" + + # Perform backend post-rendition. + svg_doPostActions + + # Perform backend last-rendition. + svg_doLastActions + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_checkColorAmount.sh b/Scripts/Bash/Functions/Render/Svg/svg_checkColorAmount.sh new file mode 100755 index 0000000..9012829 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_checkColorAmount.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# svg_checkColorAmount.sh -- This function verifies whether the list +# of colors provided in the first argument matches the amount of +# colors specified by the second argument. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_checkColorAmount { + + # Define list of colors. + local COLORS=$1 + + # Define the amount of colors the list provided must have, in + # order to be considered as valid. + local NUMBER=$2 + + # Verify amount of colors provided in the list. + if [[ $(echo "$COLORS" | wc -l) -ne $NUMBER ]];then + cli_printMessage "`gettext "The palette does not have the correct number of colors."`" --as-error-line + fi + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_checkColorFormats.sh b/Scripts/Bash/Functions/Render/Svg/svg_checkColorFormats.sh new file mode 100755 index 0000000..1f3dc74 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_checkColorFormats.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# +# svg_checkColorFormats.sh -- This function verifies formats of colors +# (i.e., the way color information is specified). +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_checkColorFormats { + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='format:' + + # Initialize ARGUMENTS with an empty value and set it as local + # variable to this function scope. + local ARGUMENTS='' + + # Initialize pattern used for color sanitation. + local PATTERN='^#[0-9a-f]{6}$' + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Look for options passed through positional parameters. + while true;do + + case "$1" in + + --format ) + + case "$2" in + + rrggbb|*) + PATTERN='^#[0-9a-f]{6}$' + ;; + + esac + shift 2 + ;; + + -- ) + shift 1 + break + ;; + esac + done + + # Define the location we want to apply verifications to. + local COLOR='' + local COLORS="$@" + + # Loop through colors and perform format verification as specified + # by pattern. + for COLOR in $COLORS;do + + if [[ ! $COLOR =~ $PATTERN ]];then + cli_printMessage "`eval_gettext "The \\\"\\\$COLOR\\\" string is not a valid color code."`" --as-error-line + fi + + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_checkModelAbsref.sh b/Scripts/Bash/Functions/Render/Svg/svg_checkModelAbsref.sh new file mode 100755 index 0000000..8ef23e7 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_checkModelAbsref.sh @@ -0,0 +1,141 @@ +#!/bin/bash +# +# svg_checkModelAbsref.sh -- This function retrives absolute files and +# checks their existence. In order for design templates to point +# different artistic motifs, design templates make use of external +# files which point to specific artistic motif background images. If +# such external files don't exist, try to create the background image +# required by cropping a higher background image (e.g., +# 2048x1536-final.png). If this isn't possible neither, then create +# the background image using a plain color and crop from it then. We +# can't go on without the required background information. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_checkModelAbsref { + + local FILE='' + local BG_DST_FILES='' + local BG_DST_FILE='' + local BG_DST_FILE_WIDTH='' + local BG_DST_FILE_HEIGHT='' + local BG_SRC_FILE='' + local BG_SRC_FILE_COLOR='' + local BG_SRC_FILE_WIDTH='' + local BG_SRC_FILE_HEIGHT='' + + # Define absolute path to the translated instance of design model. + FILE="$1" + + # Verify existence of file we need to retrive absolute paths from. + cli_checkFiles "$FILE" + + # Retrive absolute paths from file. + BG_DST_FILES=$(egrep "(sodipodi:absref|xlink:href)=\"${HOME}.+" $FILE \ + | sed -r "s,.+=\"(${HOME}.+\.png)\".*,\1," | sort | uniq) + + # Verify absolute paths retrived from file. + for BG_DST_FILE in $BG_DST_FILES;do + + # Print action message. + cli_printMessage "$BG_DST_FILE" --as-checking-line + + # Verify parent directory of absolute files retrived from + # file. This is required to prevent the construction of paths + # to locations that don't exist. For example, when including + # background images in SVG files, it is possible that the path + # information inside SVG files get outdated temporarly. If in + # that exact moment, you try to render the SVG file it won't + # be possible to create the image used for cropping because + # the path build from the location inside SVG file doesn't + # exist. In this case, centos-art.sh script will end up with + # `file ... doesn't exist' errors. + cli_checkFiles "$(dirname ${BG_DST_FILE})" -d + + if [[ ! -a $BG_DST_FILE ]];then + + # Define the source background file, the image file will + # crop when no specific background informatio be available + # for using. Generally, this is the most reusable + # background file inside the artistic motifs (e.g,. the + # `2048x1536-final.png' file). We can use this image file + # to create almost all artworks inside The CentOS + # Distribution visual manifestation when + # resolution-specific backgrounds don't exist. + BG_SRC_FILE=$(echo $BG_DST_FILE \ + | sed -r "s!(.+)/[[:digit:]]+x[[:digit:]]+(-final\.png)!\1/2048x1536\2!") + + # Verify existence of source background file. If the file + # doesn't exist create it using The CentOS Project default + # background color information, as specified in its + # corporate identity manual. + if [[ ! -f $BG_SRC_FILE ]];then + + # Define plain color that will be used as background. + BG_SRC_FILE_COLOR=$(svg_getColors) + + # Verify format of color value. + svg_checkColorFormats $BG_SRC_FILE_COLOR --format='rrggbb' + + # Define width for the source background file the + # required background information is cropped from. + BG_SRC_FILE_WIDTH=$(echo $BG_SRC_FILE \ + | sed -r 's!.+/([[:digit:]]+)x[[:digit:]]+-final\.png!\1!') + + # Define height for the source background file the + # required background information is cropped from. + BG_SRC_FILE_HEIGHT=$(echo $BG_SRC_FILE \ + | sed -r 's!.+/[[:digit:]]+x([[:digit:]]+)-final\.png!\1!') + + # Print action message. + cli_printMessage "${BG_SRC_FILE} ($BG_SRC_FILE_COLOR)" --as-creating-line + + # Create the source background file. + ppmmake -quiet ${BG_SRC_FILE_COLOR} \ + ${BG_SRC_FILE_WIDTH} ${BG_SRC_FILE_HEIGHT} \ + | pnmtopng > ${BG_SRC_FILE} + + fi + + # Print action message. + cli_printMessage "$BG_SRC_FILE" --as-cropping-line + + # Define the width of the required background information. + BG_DST_FILE_WIDTH=$(echo $BG_DST_FILE \ + | sed -r 's!.+/([[:digit:]]+)x[[:digit:]]+-final\.png!\1!') + + # Define the height of the required background information. + BG_DST_FILE_HEIGHT=$(echo $BG_DST_FILE \ + | sed -r 's!.+/[[:digit:]]+x([[:digit:]]+)-final\.png!\1!') + + # Create required backgrounnd information. + convert -quiet \ + -crop ${BG_DST_FILE_WIDTH}x${BG_DST_FILE_HEIGHT}+0+0 \ + ${BG_SRC_FILE} ${BG_DST_FILE} + + # Verify required background information. + cli_checkFiles $BG_DST_FILE + + fi + + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_checkModelExportId.sh b/Scripts/Bash/Functions/Render/Svg/svg_checkModelExportId.sh new file mode 100755 index 0000000..7d3a9fd --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_checkModelExportId.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# svg_checkModelExportId.sh -- This function standardizes the export +# id used inside svg files and the way of verify them. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_checkModelExportId { + + local INSTANCE="$1" + local EXPORTID="$2" + + # Verify instance. + cli_checkFiles $INSTANCE + + # Verify export id. + if [[ $EXPORTID == '' ]];then + cli_printMessage "`gettext "The export id value cannot be empty."`" --as-error-line + fi + + # Check export id inside design templates. + grep "id=\"$EXPORTID\"" $INSTANCE > /dev/null + if [[ $? -gt 0 ]];then + cli_printMessage "`eval_gettext "There is not export id (\\\$EXPORTID) inside \\\"\\\$TEMPLATE\\\"."`" --as-error-line + fi + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertGplToHex.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertGplToHex.sh new file mode 100755 index 0000000..48aa47e --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertGplToHex.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# svg_convertGplToHex.sh -- This function takes one palette produced +# by Gimp (e.g., syslinux.gpl) as input and outputs the list of +# hexadecimal colors and their respective index position the +# `pnmtolss16' program needs (e.g., #RRGGBB=0 #RRGGBB=1 ... [all +# values in the same line]). +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertGplToHex { + + # Define path to GPL palette. This is the .gpl file we use to + # retrive color information from. + local PALETTE_GPL="$1" + + # Define path to HEX palette. This is the palette used to stored + # the color information the `ppmtolss16' program needs. + local PALETTE_HEX="$2" + + # Define the number of colors this function should return. + local NUMBER="$3" + + # Define list of colors from GPL palette. + local COLORS=$(svg_getColors $PALETTE_GPL --head=$NUMBER --tail=$NUMBER) + + # Verify number of colors returned in the list. They must match + # exactly the amount specified, no more no less. Sometimes, the + # list of colors may have less colors than it should have, so we + # need to prevent such palettes from being used. + svg_checkColorAmount "$COLORS" "$NUMBER" + + # Verify format of colors. + svg_checkColorFormats "$COLORS" --format='rrggbb' + + # Create list of colors to be processed by `pnmtolss16'. + echo "$COLORS" | nl | gawk '{ printf "%s=%d ", $2, $1 - 1 }' \ + > $PALETTE_HEX + + # Verify HEX palette existence. + cli_checkFiles $PALETTE_HEX + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertGplToPpm.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertGplToPpm.sh new file mode 100755 index 0000000..a79ef38 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertGplToPpm.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# +# svg_convertGplToPpm.sh -- This function takes one palette produced +# by Gimp (e.g., syslinux.gpl) as input and outputs one PPM file based +# on it (e.g., syslinux.ppm). +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertGplToPpm { + + local -a FILES + local COUNT=0 + + # Define path to GPL palette. This is the .gpl file we use to + # retrive color information from. + local PALETTE_GPL="$1" + + # Define path to PPM palette. This is the .ppm file we'll save + # color information to. + local PALETTE_PPM="$2" + + # Define the number of colors this function should return. + local NUMBER="$3" + + # Define list of colors from GPL palette. + local COLOR='' + local COLORS=$(svg_getColors "$PALETTE_GPL" --head=$NUMBER --tail=$NUMBER --format='rrrggbb') + + # Verify amount of colors in the list of colors. + svg_checkColorAmount "$COLORS" "$NUMBER" + + # Verify format of colors. + svg_checkColorFormats $COLORS --format='rrggbb' + + # Create temporal images (of 1x1 pixel each) to store each color + # retrived from Gimp's palette. + for COLOR in $COLORS;do + FILES[$COUNT]=$(cli_getTemporalFile ${COUNT}.ppm) + ppmmake $COLOR 1 1 > ${FILES[$COUNT]} + COUNT=$(($COUNT + 1)) + done + + # Concatenate each temporal image from left to right to create the + # PPM file. + pnmcat -lr ${FILES[*]} > $PALETTE_PPM + + # Remove temporal images used to build the PPM palette file. + rm ${FILES[*]} + + # Verify PPM palette existence. + cli_checkFiles "$PALETTE_PPM" + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertPngTo.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertPngTo.sh new file mode 100755 index 0000000..1216e10 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertPngTo.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# svg_convertPngTo.sh -- This function provides post-rendition actions +# to use the `convert' command of ImageMagick tool set. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertPngTo { + + # Initialize image formats. + local FORMAT='' + local FORMATS=$(render_getConfigOption "$ACTION" '2') + + # Convert from PNG to specified formats. + for FORMAT in $FORMATS;do + cli_printMessage "${FILE}.${FORMAT}" --as-savedas-line + convert -quality 85 ${FILE}.png ${FILE}.${FORMAT} + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertPngToBranded.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToBranded.sh new file mode 100755 index 0000000..00c16b1 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToBranded.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# +# svg_convertPngToBranded.sh -- This function standardizes image +# branding. Once the base PNG image is rendered and the +# `--with-brands' option is provided, this function composites a new +# branded image using the preferences set in the `branding.conf' file. +# The `branding.conf' file must be stored in the design model root +# location used as reference to produce the base PNG image. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertPngToBranded { + + # Verify whether the option `--with-brands' was provided or not to + # `centos-art.sh' script command-line. + if [[ $FLAG_WITH_BRANDS == 'false' ]];then + return + fi + + local BRANDING_CONF_FILE='' + local BRANDING_CONF_SECTION='' + local BRANDING_CONF_VALUES='' + local BRANDING_CONF_VALUE='' + local BRAND='' + local POSITION='' + local POSITIONS='' + + # Define absolute path to branding configuration file. + BRANDING_CONF_FILE="$(cli_getRepoTLDir)/Identity/Models/Themes/${FLAG_THEME_MODEL}/branding.conf" + + # Define regular expression matching the variable name (i.e., the + # left column), inside the configuration line, you want to match + # on. + BRANDING_CONF_VARNAME=$(echo $TEMPLATE | cut -d/ -f10-) + + # Define list of configuration lines related to current design + # model. This are the lines that tell us how and where to apply + # branding information on base PNG image. Be sure that only + # configuration lines from supported section names (e.g., + # `symbol', `type', `logo') be read, no need to waste resources + # with others. + BRANDING_CONF_VALUES=$(\ + for BRANDING_CONF_SECTION in $(echo "types symbols logos");do + cli_getConfigValue "${BRANDING_CONF_FILE}" "${BRANDING_CONF_SECTION}" "${BRANDING_CONF_VARNAME}" + done) + + for BRANDING_CONF_VALUE in $BRANDING_CONF_VALUES;do + + # Define absolute path to image file used as brand. This is + # the image put over the PNG image produced as result of + # design models base rendition. + BRAND="$(cli_getRepoTLDir)/Identity/Images/Brands/$(echo $BRANDING_CONF_VALUE \ + | gawk 'BEGIN{ FS=":" } { print $1 }')" + + # Verify absolute path to image file used as brand. Assuming + # no brand image file is found, continue with the next + # configuration line. + if [[ ! -f $BRAND ]];then + continue + fi + + # Define list of positions using the format of ImageMagick + # `-geometry' option argument. + POSITIONS=$(echo "$BRANDING_CONF_VALUE" | cut -d: -f2- | tr ':' ' ') + + # Loop through list of brand image positions and use the + # composite command from ImageMagick, to overlap brand image + # over unbranded image just rendered. + for POSITION in $POSITIONS;do + composite -geometry $POSITION $BRAND ${FILE}.png ${FILE}.png + done + + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertPngToBrands.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToBrands.sh new file mode 100755 index 0000000..75b41ab --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToBrands.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# +# svg_convertPngToBrands.sh -- This function provides post-rendition +# actions to produce brand images in different sizes and formats from +# the same SVG design model. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertPngToBrands { + + # Define height dimensions you want to produce brands for. + local SIZE="" + local SIZES="16 20 22 24 32 36 38 40 48 64 72 78 96 112 124 128 148 164 196 200 512" + + # Define image formats you want to produce brands for. + local FORMAT="" + local FORMATS="xpm pdf jpg tif" + + for SIZE in ${SIZES};do + + # Redefine absolute path to file location where size-specific + # images will be stored in. + local FINALFILE=$(dirname $FILE)/${SIZE}/$(basename $FILE) + + # Prepare directory where size-specific images will be stored + # in. If it doesn't exist create it. + if [[ ! -d $(dirname $FINALFILE) ]];then + mkdir -p $(dirname $FINALFILE) + fi + + # Print action message. + cli_printMessage "${FINALFILE}.png" --as-creating-line + + # Create size-specific PNG image ommiting all output. + inkscape $INSTANCE --export-id=$EXPORTID \ + --export-png=${FINALFILE}.png --export-height=${SIZE} \ + &> /dev/null + + for FORMAT in ${FORMATS};do + + # Print action message. + cli_printMessage "${FINALFILE}.${FORMAT}" --as-creating-line + + # Convert size-specific PNG image into different formats. + convert ${FINALFILE}.png ${FINALFILE}.${FORMAT} + + done + + # Create copy of size-specific image in 2 colors. + cli_printMessage "${FINALFILE}.xbm" --as-creating-line + convert -colorspace gray -colors 2 ${FINALFILE}.png ${FINALFILE}.xbm + + # Create copy of size-specific image with emboss effect. + cli_printMessage "${FINALFILE}-emboss.png" --as-creating-line + convert -emboss 1 ${FINALFILE}.png ${FINALFILE}-emboss.png + + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertPngToDm.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToDm.sh new file mode 100755 index 0000000..a2dd443 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToDm.sh @@ -0,0 +1,185 @@ +#!/bin/bash +# +# svg_convertPngToDm.sh -- This function standardize production of +# display managers (e.g., Gdm and Kdm). This function copies all files +# needed into a temporal directory, realize expansion of translation +# markers and packs all the files into a tar.gz package that is used +# for installation. This function must be used as last-rendition +# action for Gdm and Kdm directory specific base-rendition actions. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertPngToDm { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Initialize source and destination local variables. + local SRC='' + local DST='' + + # Initialize display manager type. + local DM=$(render_getConfigOption "${ACTION}" '2') + + # Initialize screen resolutions used by display manager theme. + # These are the different screen resolutions a display manager + # theme is built for. The amount of screen resolution a display + # manager theme can be built for is limited to the amount of + # background files provided by the artistic motif used to build + # the display manager theme. + local RESOLUTION='' + local RESOLUTIONS=$(render_getConfigOption "${ACTION}" '3') + + # Verify screen resolutions. We cannot produce display manager + # theme if no screen resolution has been specified. + if [[ "$RESOLUTIONS" == '' ]];then + cli_printMessage "`gettext "There is no resolution information to process."`" --as-error-line + fi + + # Initialize theme information we are going to build the display + # manager theme for. + local THEME=$(cli_getPathComponent $ACTIONVAL --motif) + local THEME_NAME=$(cli_getPathComponent $ACTIONVAL --motif-name) + + # Initialize temporal directory where we collect all files needed + # in order to create the tar.gz file. This intermediate step is + # also needed in order to expand translation markers from XML and + # Desktop definitions. + local TMPDIR=$(cli_getTemporalFile 'dm') + + # Initialize source location for brands. This is the place where + # brand information, needed to build the display manager theme, is + # retrived from. + local BRANDS=$(cli_getRepoTLDir)/Identity/Images/Brands + + # Initialize source location for artistic motif's backgrounds. + # This is the place where background information needed to ubild + # the display manager theme is retrived from. + local BGS=$(cli_getRepoTLDir)/Identity/Images/Themes/${THEME}/Backgrounds/Img/Png + + # Initialize file variables. File variables are used build and + # process the file relation between source and target locations. + local FILE='' + local FILES='' + + # Define major release from template. + local MAJOR_RELEASE=$(cli_getPathComponent "$TEMPLATE" "--release-major") + + # Define file relation between source and target locations, based + # on whether we are producing GDM or KDM. Use the colon character + # (`:') as separator; on the left side we put the file's source + # location and in the right side the file's target location. + # Presently, both GDM and KDM are very similar on files with the + # exception that GDM does use icons near actions buttons (e.g., + # shutdown, reboot, session, language) and KDM doesn't. + case ${DM} in + + Gdm ) + FILES="\ + ${BRANDS}/Symbols/48/centos.png:centos-symbol.png + ${BRANDS}/Types/White/112/centos-${MAJOR_RELEASE}-msg.png:centos-release.png + ${OUTPUT}/screenshot.png:screenshot.png + $(dirname $TEMPLATE)/GdmGreeterTheme.xml:${THEME_NAME}.xml + $(dirname $TEMPLATE)/GdmGreeterTheme.desktop:GdmGreeterTheme.desktop + $(dirname $TEMPLATE)/icon-language.png:icon-language.png + $(dirname $TEMPLATE)/icon-reboot.png:icon-reboot.png + $(dirname $TEMPLATE)/icon-session.png:icon-session.png + $(dirname $TEMPLATE)/icon-shutdown.png:icon-shutdown.png + " + ;; + + Kdm ) + FILES="\ + ${BRANDS}/Symbols/48/centos.png:centos-symbol.png + ${BRANDS}/Types/White/112/centos-${MAJOR_RELEASE}-msg.png:centos-release.png + ${OUTPUT}/screenshot.png:screenshot.png + $(dirname $TEMPLATE)/GdmGreeterTheme.xml:${THEME_NAME}.xml + $(dirname $TEMPLATE)/GdmGreeterTheme.desktop:GdmGreeterTheme.desktop + " + ;; + + * ) + cli_printMessage "`eval_gettext "The \\\"\\\$DM\\\" display manager is not supported yet."`" --as-error-line + ;; + esac + + for FILE in $FILES;do + + # Define source location. + SRC=$(echo $FILE | cut -d: -f1) + + # Define target location. + DST=${TMPDIR}/${THEME_NAME}/$(echo $FILE | cut -d: -f2) + + # Verify source files. + cli_checkFiles $SRC + + # Verify parent directory for target file. + if [[ ! -d $(dirname $DST) ]];then + mkdir -p $(dirname $DST) + fi + + # Copy files from source to target location. + cp ${SRC} ${DST} + + # Expand translation markers. + if [[ ${DST} =~ "\.(xml|desktop)$" ]];then + cli_expandTMarkers "${DST}" + fi + + done + + # Move into temporal directory. + pushd $TMPDIR > /dev/null + + for RESOLUTION in $RESOLUTIONS;do + + # Verify background information. If it doesn't exist go on + # with the next one in the list. + if [[ ! -f $BGS/${RESOLUTION}-final.png ]];then + continue + fi + + # Print action message. + if [[ -f ${RESOLUTION}.tar.gz ]];then + cli_printMessage "${OUTPUT}/${RESOLUTION}.tar.gz" --as-updating-line + else + cli_printMessage "${OUTPUT}/${RESOLUTION}.tar.gz" --as-creating-line + fi + + # Copy background information. + cp $BGS/${RESOLUTION}-final.png ${THEME_NAME}/background.png + + # Create tar.gz file. + tar -czf ${RESOLUTION}.tar.gz ${THEME_NAME} + + # Move from temporal directory to its final location. + mv ${RESOLUTION}.tar.gz ${OUTPUT} + + done + + # Return to where we were initially. + popd > /dev/null + + # Remove temporal directory. + rm -r ${TMPDIR} + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertPngToGrub.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToGrub.sh new file mode 100755 index 0000000..4ecdf4e --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToGrub.sh @@ -0,0 +1,143 @@ +#!/bin/bash +# +# svg_convertPngToGrub.sh -- This function provides post-rendition +# action used to produce GRUB images. +# +# Initially, the color information is defined with GIMP (The GNU Image +# Manipulation Program) as a `.gpl' palette of color. This palette of +# colors contains 14 colors only and is saved in a file named +# `grub.gpl. The `grub.gpl' file is used to build the `grub.ppm' file +# which provide the color information needed to reduce the full color +# PNG image, produced as result of SVG base-rendition, to the amount +# of colors specified (i.e., 14 colors). Later, with the 14 color PNG +# image already created, the `grub.ppm' file is used to build the +# `splash.xpm.gz' file. +# +# In order for this function to work, the `grub.gpl' file should have +# a format similar to the following: +# +# GIMP Palette +# Name: CentOS-TreeFlower-4-Syslinux +# Columns: 14 +# # +# 32 76 141 204c8d +# 36 82 146 245292 +# 52 93 152 345d98 +# 72 108 162 486ca2 +# 102 131 176 6683b0 +# 126 153 190 7e99be +# 146 170 200 92aac8 +# 161 182 209 a1b6d1 +# 182 199 219 b6c7db +# 202 214 228 cad6e4 +# 221 230 238 dde6ee +# 235 241 245 ebf1f5 +# 246 251 254 f6fbfe +# 254 255 252 fefffc +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertPngToGrub { + + # Define number of colors the images will be produced on. + local COLORS='14' + + # Define options using those passed to actions from pre-rendition + # configuration script. These options are applied to pnmremap when + # doing color reduction, so any option available for pnmremap + # command can be passed to renderSyslinux functionality. + local OPTIONS=$(render_getConfigOption "$ACTION" '2-') + + # Check options passed to action. This is required in order to + # aviod using options used already in this script. For example + # -verbose and -mapfile options. + for OPTION in $OPTIONS;do + # Remove anything after equal sign inside option. + OPTION=$(echo -n $OPTION | cut -d'=' -f1) + if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then + cli_printMessage "`eval_gettext "The \\\"\\\$OPTION\\\" option is already used."`" --as-error-line + fi + done + + # Define file name prefix. + local PREFIX="-${COLORS}c" + + # Redefine file name prefix using options as reference. This is + # useful to differenciate final files produced using + # Floyd-Steinberg dithering and files which are not. + if [[ "$OPTIONS" =~ '-floyd' ]];then + PREFIX="${PREFIX}-floyd" + fi + + # Define absolute path to GPL palette. This palettes should have + # 14 colors only. For more information on this see the GRUB's + # documentation. + local PALETTE_GPL=${MOTIF_DIR}/Palettes/grub.gpl + + # Verify GPL palette existence. If it doesn't exist copy the one + # provided by the design model through subversion (to keep track + # of the change) and expand translation markers in the copied + # instance. + if [[ ! -f $PALETTE_GPL ]];then + svn cp ${MODEL_BASEDIR}/${FLAG_THEME_MODEL}/Palettes/grub.gpl ${PALETTE_GPL} + cli_expandTMarkers ${PALETTE_GPL} + fi + + # Define absolute path to PPM palette. The PPM palette is built + # from source palette (PALETTE_GPL) and provides the color + # information understood by `ppmremap', the program used to + # produce images in a specific amount of colors. + local PALETTE_PPM=$(cli_getTemporalFile "grub.ppm") + + # Create image in Netpbm superformat (PNM). The PNM image file is + # created from the PNG image rendered previously as centos-art + # base-rendition output. The PNM image is an intermediate format + # used to manipulate images through Netpbm tools. + cli_printMessage "${FILE}.pnm" --as-savedas-line + pngtopnm -verbose \ + < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm + + # Print the path to GPL palette. + cli_printMessage "$PALETTE_GPL" --as-palette-line + + # Create PPM palette using GPL palette. + svg_convertGplToPpm "$PALETTE_GPL" "$PALETTE_PPM" "$COLORS" + + # Reduce colors as specified in PPM palette. Here we use the PPM + # palette to enforce the color position in the image index and the + # Floyd-Steinberg dithering in order to improve color reduction. + cli_printMessage "${FILE}${PREFIX}.ppm" --as-savedas-line + pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ + < ${FILE}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.ppm + + # Remove PPM palette. It is no longer needed. + if [[ -f ${PALETTE_PPM} ]];then + rm $PALETTE_PPM + fi + + # Create the 14 colors xpm.gz file. + cli_printMessage "${FILE}${PREFIX}.xpm.gz" --as-savedas-line + ppmtoxpm \ + < ${FILE}${PREFIX}.ppm 2>>${FILE}.log > ${FILE}.xpm \ + && gzip --force ${FILE}.xpm \ + && mv ${FILE}.xpm.gz ${FILE}${PREFIX}.xpm.gz + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertPngToIcons.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToIcons.sh new file mode 100755 index 0000000..f63d7c5 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToIcons.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# +# svg_convertPngToIcons.sh -- This function provides post-rendition +# actions to produce icon images in different sizes and formats from +# the same SVG design model. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertPngToIcons { + + # Define height dimensions you want to produce brands for. + local SIZE="" + local SIZES="16 20 22 24 32 36 40 48 64 96 128 148 164 196 200 512" + + # Define image formats you want to produce brands for. + local FORMAT="" + local FORMATS="" + + for SIZE in ${SIZES};do + + # Redefine absolute path to file location where size-specific + # images will be stored in. + local FINALFILE=$(dirname $FILE)/${SIZE}/$(basename $FILE) + + # Prepare directory where size-specific images will be stored + # in. If it doesn't exist create it. + if [[ ! -d $(dirname $FINALFILE) ]];then + mkdir -p $(dirname $FINALFILE) + fi + + # Print action message. + cli_printMessage "${FINALFILE}.png" --as-creating-line + + # Create size-specific PNG image ommiting all output. + inkscape $INSTANCE --export-id=$EXPORTID \ + --export-png=${FINALFILE}.png --export-height=${SIZE} \ + &> /dev/null + + #for FORMAT in ${FORMATS};do + # + # # Print action message. + # cli_printMessage "${FINALFILE}.${FORMAT}" --as-creating-line + # + # # Convert size-specific PNG image into different formats. + # convert ${FINALFILE}.png ${FINALFILE}.${FORMAT} + # + #done + + # Create copy of size-specific image in 2 colors. + #cli_printMessage "${FINALFILE}.xbm" --as-creating-line + #convert -colorspace gray -colors 2 ${FINALFILE}.png ${FINALFILE}.xbm + + # Create copy of size-specific image with emboss effect. + #cli_printMessage "${FINALFILE}-emboss.png" --as-creating-line + #convert -emboss 1 ${FINALFILE}.png ${FINALFILE}-emboss.png + + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertPngToKsplash.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToKsplash.sh new file mode 100755 index 0000000..6f7049f --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToKsplash.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# +# svg_convertPngToKsplash.sh -- This function collects KDE splash +# (KSplash) required files and creates a tar.gz package that groups +# them all together. Use this function as last-rendition action for +# KSplash base-rendition action. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertPngToKsplash { + + local -a SRC + local -a DST + local FONT='' + local COUNT=0 + + # Define font used to print bottom splash message. + FONT=$(cli_getTTFont "DejaVuLGCSans-Bold") + + # Check existence of font file. + cli_checkFiles "$FONT" + + # Define absolute source location of files. + SRC[0]="${OUTPUT}/splash_top.png" + SRC[1]="${OUTPUT}/splash_active_bar.png" + SRC[2]="${OUTPUT}/splash_inactive_bar.png" + SRC[3]="${OUTPUT}/splash_bottom.png" + SRC[4]="$(dirname $TEMPLATE)/Theme.rc" + + # Check absolute source location of files. + cli_checkFiles "${SRC[@]}" + + # Define relative target location of files. + DST[0]="${OUTPUT}/splash_top.png" + DST[1]="${OUTPUT}/splash_active_bar.png" + DST[2]="${OUTPUT}/splash_inactive_bar.png" + DST[3]="${OUTPUT}/splash_bottom.png" + DST[4]="${OUTPUT}/Theme.rc" + + # Print action message. + cli_printMessage "${OUTPUT}/Preview.png" --as-creating-line + + # Create `Preview.png' image. + convert -append ${SRC[0]} ${SRC[1]} ${SRC[3]} ${OUTPUT}/Preview.png + + # Add bottom text to Preview.png image. The text position was set + # inside an image of 400x300 pixels. If you change the final + # preview image dimension, you probably need to change the text + # position too. + mogrify -draw 'text 6,295 "KDE is up and running."' \ + -fill \#ffffff \ + -font $FONT \ + ${OUTPUT}/Preview.png + + # Copy `Theme.rc' file. + cp ${SRC[4]} ${DST[4]} + + # Apply common translation markers to Theme.rc file. + cli_expandTMarkers "${DST[4]}" + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertPngToSyslinux.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToSyslinux.sh new file mode 100755 index 0000000..548cb21 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToSyslinux.sh @@ -0,0 +1,184 @@ +#!/bin/bash +# +# svg_convertPngToSyslinux.sh -- This function provides post-rendition +# action used to produce LSS16 images, the images used by isolinux. +# +# Initially, the color information is defined with GIMP (The GNU Image +# Manipulation Program) as a `.gpl' palette of color. This palette of +# colors contains 16 colors only and is saved in a file named +# `syslinux.gpl. The `syslinux.gpl' file is used to build two other +# files: the `syslinux.ppm' file and the `syslinux.hex' file. The +# `syslinux.ppm' provides the color information needed to reduce the +# full color PNG image, produced as result of SVG base-rendition, to +# the amount of colors specified (i.e., 16 colors). Later, with the 16 +# color PNG image already created, the `syslinux.hex' file is used to +# build the LSS16 image. +# +# In order to produce images in LSS16 format correctly, it is required +# that both the `syslinux.ppm' and `syslinux.hex' files do contain the +# same color information. This is, both `syslinux.ppm' and +# `syslinux.hex' must represent the same color values and in the same +# color index. +# +# In order for this function to work, the `syslinux.gpl' file should +# have a format similar to the following: +# +# GIMP Palette +# Name: CentOS-TreeFlower-4-Syslinux +# Columns: 16 +# # +# 32 76 141 204c8d +# 37 82 146 255292 +# 52 94 153 345e99 +# 73 110 162 496ea2 +# 91 124 172 5b7cac +# 108 136 180 6c88b4 +# 120 146 186 7892ba +# 131 158 193 839ec1 +# 255 255 255 ffffff +# 146 170 200 92aac8 +# 162 182 209 a2b6d1 +# 183 199 219 b7c7db +# 204 216 230 ccd8e6 +# 221 229 238 dde5ee +# 235 241 245 ebf1f5 +# 246 251 254 f6fbfe +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertPngToSyslinux { + + # Define number of colors the images will be produced on. + local COLORS='16' + + # Define options using those passed to actions from pre-rendition + # configuration script. These options are applied to pnmremap when + # doing color reduction, so any option available for pnmremap + # command can be passed to renderSyslinux functionality. + local OPTIONS=$(render_getConfigOption "$ACTION" '2-') + + # Check options passed to action. This is required in order to + # aviod using options already used in this script. For example + # -verbose and -mapfile options. + for OPTION in $OPTIONS;do + # Remove anything after equal sign inside option. + OPTION=$(echo $OPTION | cut -d'=' -f1) + if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then + cli_printMessage "`eval_gettext "The \\\"\\\$OPTION\\\" option is already used."`" --as-error-line + fi + done + + # Define default file name prefix for 16 colors images. + local PREFIX="-${COLORS}c" + + # Re-define 16 colors images default file name prefix using + # options as reference. This is useful to differenciate final + # files produced using Floyd-Steinberg dithering and final files + # which are not. + if [[ "$OPTIONS" =~ '-floyd' ]];then + PREFIX="${PREFIX}-floyd" + fi + + # Define absolute path to GPL palette. The GPL palette defines the + # color information used to build syslinux images. This palette + # should be set to 16 colors and, as specified in isolinux + # documentation, the background color should be indexed on + # position 0 and the forground in position 7 (see + # /usr/share/doc/syslinux-X.XX/isolinux.doc, for more + # information.) + local PALETTE_GPL=${MOTIF_DIR}/Palettes/syslinux.gpl + + # Verify GPL palette existence. If it doesn't exist copy the one + # provided by the design model through subversion (to keep track + # of the change) and expand translation markers in the copied + # instance. + if [[ ! -f $PALETTE_GPL ]];then + svn cp ${MODEL_BASEDIR}/${FLAG_THEME_MODEL}/Palettes/syslinux.gpl ${PALETTE_GPL} + cli_expandTMarkers ${PALETTE_GPL} + fi + + # Define absolute path to PPM palette. The PPM palette is built + # from source palette (PALETTE_GPL) and provides the color + # information understood by `ppmremap', the program used to + # produce images in a specific amount of colors. + local PALETTE_PPM=$(cli_getTemporalFile "syslinux.ppm") + + # Define the HEX palette. The HEX palette is built from source + # palette (PALETTE_GPL) and provides the color information in the + # format understood by `ppmtolss16', the program used to produce + # images in LSS16 format. The HEX palette stores just one line + # with the color information as described in isolinux + # documentation (i.e #RRGGBB=0 #RRGGBB=1 ... [all values in the + # same line]) + local PALETTE_HEX=$(cli_getTemporalFile "syslinux.hex") + + # Create image in Netpbm superformat (PNM). The PNM image file is + # created from the PNG image rendered previously as centos-art + # base-rendition output. The PNM image is an intermediate format + # used to manipulate images through Netpbm tools. + cli_printMessage "${FILE}.pnm" --as-savedas-line + pngtopnm -verbose \ + < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm + + # Print the path to GPL palette. + cli_printMessage "$PALETTE_GPL" --as-palette-line + + # Create PPM palette using GPL palette. + svg_convertGplToPpm "$PALETTE_GPL" "$PALETTE_PPM" "$COLORS" + + # Create HEX palette using GPL palette. + svg_convertGplToHex "$PALETTE_GPL" "$PALETTE_HEX" "$COLORS" + + # Reduce colors as specified in PPM palette. Here we use the PPM + # palette to enforce the color position in the image index and the + # Floyd-Steinberg dithering in order to improve color reduction. + cli_printMessage "${FILE}${PREFIX}.pnm" --as-savedas-line + pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ + < ${FILE}.pnm 2>> ${FILE}.log > ${FILE}${PREFIX}.pnm + + # Create LSS16 image. + cli_printMessage "${FILE}${PREFIX}.lss" --as-savedas-line + ppmtolss16 $(cat $PALETTE_HEX) \ + < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.lss + + # Remove HEX palette. It is no longer needed. + if [[ -f ${PALETTE_HEX} ]];then + rm $PALETTE_HEX + fi + + # Create the PPM image indexed to 16 colors. Also the colormap + # used in the LSS16 image is saved on ${FILE}.log; this is useful to + # verify the correct order of colors in the image index. + cli_printMessage "${FILE}${PREFIX}.ppm" --as-savedas-line + lss16toppm -map \ + < ${FILE}${PREFIX}.lss 2>>${FILE}.log > ${FILE}${PREFIX}.ppm + + # Create the 16 colors PNG image. + cli_printMessage "${FILE}${PREFIX}.png" --as-savedas-line + pnmtopng -verbose -palette=$PALETTE_PPM \ + < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.png + + # Remove PPM palette. It is no longer needed. + if [[ -f ${PALETTE_PPM} ]];then + rm $PALETTE_PPM + fi + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_convertPngToThumbnail.sh b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToThumbnail.sh new file mode 100755 index 0000000..6e319e2 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_convertPngToThumbnail.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# svg_convertPngToThumbnail.sh -- This function provides +# post-rendition to create thumbnails from images produced by +# centos-art base-rendition. Thumbnails are created in PNG and JPG +# format for you to decide which is the more appropriate one. When no +# size is specified, thumbnails are created at 250 pixels width and +# height is automatically calculated to match the image ratio. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_convertPngToThumbnail { + + # Get image size. + local SIZE='' + local SIZES=$(render_getConfigOption "$ACTION" '2-') + + # Check image sizes and do convertion. + if [[ "$SIZES" == "" ]];then + SIZES='250' + fi + + # Check base file existence. + cli_checkFiles "${FILE}.png" + + # Create thumbnails. + for SIZE in $SIZES;do + cli_printMessage "${FILE}-thumb-${SIZE}.png" --as-savedas-line + convert -thumbnail ${SIZE} ${FILE}.png ${FILE}-thumb-${SIZE}.png + cli_printMessage "${FILE}-thumb-${SIZE}.jpg" --as-savedas-line + convert -thumbnail ${SIZE} ${FILE}-thumb-${SIZE}.png ${FILE}-thumb-${SIZE}.jpg + cli_printMessage "${FILE}-thumb-${SIZE}.pdf" --as-savedas-line + convert -thumbnail ${SIZE} ${FILE}-thumb-${SIZE}.png ${FILE}-thumb-${SIZE}.pdf + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_doLastActions.sh b/Scripts/Bash/Functions/Render/Svg/svg_doLastActions.sh new file mode 100755 index 0000000..f28eef6 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_doLastActions.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# svg_doLastActions.sh -- This function performs last-rendition +# actions for SVG files. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_doLastActions { + + # Verify position of file being produced in the list of files been + # currently processed. + if [[ $THIS_FILE_DIR == $NEXT_FILE_DIR ]];then + return + fi + + local ACTION='' + + # Redefine SVG last-rendition actions as local to avoid undesired + # concatenation when massive rendition is performed. + local -a LASTACTIONS + + # Define SVG directory-specific actions. This is required in order + # to provide a predictable way of producing content inside the + # repository and save you the time of writing long several + # commands each time you need to produce images inside the + # repository. + if [[ $FLAG_DONT_DIRSPECIFIC == 'false' ]];then + if [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Gdm/.+\.svg$" ]];then + LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToDm:Gdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240' + elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Kdm/.+\.svg$" ]];then + LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToDm:Kdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240' + elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Ksplash/.+\.svg$" ]];then + LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToKsplash:' + fi + fi + + # Define SVG last-rendition actions. Since last-rendition makes + # use of all files in the output directory structure and + # directory-specific rendition modifies all the files in the + # output directory structure as well, these actions must be + # defined after the directory-specific definition. Otherwise, + # modifications impossed by these actions may interfier the whole + # purpose of having a directory-specific rendition. + [[ $FLAG_LASTRENDITION != '' ]] && LASTACTIONS[((++${#LASTACTIONS[*]}))]="doLastActions:(png|jpg):${FLAG_LASTRENDITION}" + + # At this point centos-art.sh should be producing the last file + # from the same unique directory structure, so, before producing + # images for the next directory structure lets execute the list of + # last-rendition actions for the current directory structure. + for ACTION in "${LASTACTIONS[@]}"; do + svg_$(echo "$ACTION" | cut -d: -f1) + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_doLastCommand.sh b/Scripts/Bash/Functions/Render/Svg/svg_doLastCommand.sh new file mode 100755 index 0000000..eae59b9 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_doLastCommand.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# +# svg_doLastCommand.sh -- This function standardizes the way +# last-rendition commands are applied to base-rendition and +# post-rendition outputs. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_doLastCommand { + + # Define the file extensions. This value is a regular expression + # pattern which must match the file extensions that last-rendition + # actions will be applied to. + local EXTENSION=$(render_getConfigOption "$ACTION" '2') + + # Define the command string that will be evaluated as + # last-rendition action. Only commands that perform in-place + # modifications can be passed here. + local COMMAND=$(render_getConfigOption "$ACTION" '3-') + + # Define the list of files to process. This value contain all the + # files in the output directory which extension match the + # extension pattern previously defined. + local FILE='' + local FILES=$(cli_getFilesList $OUTPUT --pattern=".+\.${EXTENSION}") + + for FILE in $FILES;do + + # Identify file before processing it. Only formats recognized + # by ImageMagick are supported. In case the file isn't + # supported by ImageMagick, continue with the next file in the + # list. + identify -quiet ${FILE} > /dev/null + if [[ $? -ne 0 ]];then + continue + fi + + # Print action message. + cli_printMessage "${FILE}" --as-updating-line + + # Execute mogrify action on all files inside the same + # directory structure. + eval ${COMMAND} ${FILE} + + # Be sure the command was executed correctly. Otherwise stop + # script execution. + if [[ $? -ne 0 ]];then + exit + fi + + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_doPostActions.sh b/Scripts/Bash/Functions/Render/Svg/svg_doPostActions.sh new file mode 100755 index 0000000..1a10b2f --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_doPostActions.sh @@ -0,0 +1,94 @@ +#!/bin/bash +# +# svg_doPostActions.sh -- This function performs post-rendition +# actions for SVG files. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_doPostActions { + + local ACTION='' + + # Redefine SVG post-rendition actions as local to avoid undesired + # concatenation when massive rendition is performed. + local -a POSTACTIONS + + # Define default comment written to base-rendition output. + local COMMENT="`gettext "Created in CentOS Artwork Repository"` ($(cli_printUrl '--projects-artwork'))" + + # Define SVG post-rendition actions. Since these actions are + # applied to base-rendition output and base-rendition output is + # used as reference to perform directory-specific rendition, these + # action must be defined before directory-specific rendition. + # Otherwise it wouldn't be possible to propagate changes impossed + # by these actions to new files produced as result of + # directory-specific rendition. + POSTACTIONS[((++${#POSTACTIONS[*]}))]="doPostCommand:png:mogrify -comment '$COMMENT'" + [[ $FLAG_POSTRENDITION != '' ]] && POSTACTIONS[((++${#POSTACTIONS[*]}))]="doPostCommand:png:${FLAG_POSTRENDITION}" + + # Define SVG directory-specific rendition. Directory-specfic + # rendition provides a predictable way of producing content inside + # the repository. + if [[ $FLAG_DONT_DIRSPECIFIC == 'false' ]];then + + if [[ $TEMPLATE =~ 'trunk/Identity/(Models|Images)/Themes/.+\.svg$' ]];then + + POSTACTIONS[((++${#POSTACTIONS[*]}))]="convertPngToBranded" + + if [[ $TEMPLATE =~ "Backgrounds/.+\.svg$" ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='groupBy:png jpg' + + elif [[ $TEMPLATE =~ "Concept/.+\.svg$" ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg pdf' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToThumbnail:250' + + elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Syslinux/.+\.svg$" ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToSyslinux:' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToSyslinux:-floyd' + + elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Grub/.+\.svg$" ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToGrub:' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToGrub:-floyd' + + elif [[ $TEMPLATE =~ "Posters/.+\.svg$" ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg pdf' + fi + + elif [[ $TEMPLATE =~ "trunk/Identity/Models/Brands/.+\.svg$" ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToBrands' + + elif [[ $TEMPLATE =~ "trunk/Identity/Models/Icons/.+\.svg$" ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToIcons' + + elif [[ $TEMPLATE =~ "trunk/Identity/Models/Manuals.+\.svg$" ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg pdf' + + fi + + fi + + # Execute SVG post-rendition actions. + for ACTION in "${POSTACTIONS[@]}"; do + svg_$(echo "$ACTION" | cut -d: -f1) + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_doPostCommand.sh b/Scripts/Bash/Functions/Render/Svg/svg_doPostCommand.sh new file mode 100755 index 0000000..10c7f4b --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_doPostCommand.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# svg_doPostCommand.sh -- This function standardizes the way +# post-rendition commands are applied to base-rendition output. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_doPostCommand { + + # Define the file extension of base-rendition output. + local EXTENSION=$(render_getConfigOption "$ACTION" '2') + + # Define the command string. + local COMMAND=$(render_getConfigOption "$ACTION" '3-') + + # Verify the absolute path of base-rendition output. + cli_checkFiles ${FILE}.${EXTENSION} + + # Execute the command string on base-rendition output. + eval $COMMAND ${FILE}.${EXTENSION} + + # Be sure the command string was executed correctly. Otherwise + # stop the script execution. + if [[ $? -ne 0 ]];then + exit + fi + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_getColors.sh b/Scripts/Bash/Functions/Render/Svg/svg_getColors.sh new file mode 100755 index 0000000..f4dd076 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_getColors.sh @@ -0,0 +1,153 @@ +#!/bin/bash +# +# svg_getColors.sh -- This function takes one palette produced by Gimp +# (e.g., syslinux.gpl) as input and outputs a list of colors in the +# specified format. In order for this function to output the color in +# the format specified, it is needed that the fourth column in the gpl +# palette be set in the `rrggbb' format and the appropriate conversion +# be implemented here. +# +# Notice that using both the `--head' and `--tail' options it is +# possible to control how many consecutive items does the list of +# colors is going to have. It is possible to output all colors in the +# list, or a consecutive range of them. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_getColors { + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='head:,tail:,format:' + + # Initialize ARGUMENTS with an empty value and set it as local + # variable to this function scope. + local ARGUMENTS='' + + # Initialize both head and tail values to return the first line of + # color information from the palette. + local HEAD=1 + local TAIL=1 + + # Initialize format value used as default when no format option be + # provided. + local FORMAT='rrggbb' + + # Initialize list of colors. + local COLORS='' + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Look for options passed through positional parameters. + while true;do + + case "$1" in + + --head ) + HEAD=$2 + shift 2 + ;; + + --tail ) + TAIL=$2 + shift 2 + ;; + + --format ) + FORMAT=$2 + shift 2 + ;; + + -- ) + shift 1 + break + ;; + esac + done + + # Define path to gpl palette. This is the first file we use to + # retrive color information from. Only the first file provided + # will be used. + local PALETTE=$(echo $@ | cut -d' ' -f1) + + if [[ $PALETTE == '' ]];then + + # Define palette path inside the theme's artistic motif. + local MOTIF_PALETTE=$(cli_getRepoTLDir)/Identity/Images/Themes/$(cli_getPathComponent $ACTIONVAL --motif)/Palettes/grub.gpl + + # Define palette path inside the theme's design model. + local MODEL_PALETTE=$(cli_getRepoTLDir)/Identity/Models/Themes/${THEME_MODEL_NAME}/Palettes/grub.gpl + + # Redefine default background color using palettes provided by + # artistic motif first, and design model later. Assuming none + # of them is present, use The CentOS Project default color + # then. + if [[ -f $MOTIF_PALETTE ]];then + COLORS=$(svg_getColors $MOTIF_PALETTE --head=1 --tail=1) + elif [[ -f $MODEL_PALETTE ]];then + COLORS=$(svg_getColors $MODEL_PALETTE --head=1 --tail=1) + else + COLORS='#204c8d' + fi + + else + + # Retrive the fourth column from GPL palette. The fourth + # column of a GPL palette contains the palette commentary + # field. The palette commentary field can be anything, but for + # the sake of our own convenience we use it to store the color + # value in hexadecimal format (e.g., rrggbb). Notice that you + # can put your comments from the fifth column on using an + # space as field separator. + COLORS=$(sed -r '1,/^#/d' $PALETTE \ + | awk '{ printf "%s\n", $4 }' | head -n $HEAD | tail -n $TAIL) + + fi + + # Implement color formats convertions from rrggbb to other formats + # that you might need to use. + for COLOR in $COLORS;do + + case $FORMAT in + + rrggbb|* ) + if [[ ! $COLOR =~ '^#' ]];then + COLOR="#${COLOR}" + fi + ;; + + esac + + # Output color value. + echo "$COLOR" + + done + +} diff --git a/Scripts/Bash/Functions/Render/Svg/svg_groupBy.sh b/Scripts/Bash/Functions/Render/Svg/svg_groupBy.sh new file mode 100755 index 0000000..1e747d8 --- /dev/null +++ b/Scripts/Bash/Functions/Render/Svg/svg_groupBy.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# svg_groupBy.sh -- This function provides post-rendition action to +# group files inside directories named as their file extensions. For +# example: if the current file is a .png file, it is moved inside a +# Png/ directory; if the current file is a .jpg file, it is stored +# inside a Jpg/ directory, and so on. +# +# For this function to work correctly, you need to specify which file +# type you want to group. This is done in the post-rendition ACTIONS +# array inside the appropriate `render.conf.sh' pre-configuration +# script. This function cannot be used as last-rendition action. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_groupBy { + + local SOURCE='' + local TARGET='' + + # Sanitate file types passed from render.conf.sh pre-rendition + # configuration script. + local FORMAT='' + local FORMATS=$(render_getConfigOption "$ACTION" '2-') + + for FORMAT in $FORMATS;do + + # Redifine source file we want to move. + SOURCE=${FILE}.${FORMAT} + + # Define target directory where source file will be moved + # into. + TARGET=$(dirname "$FILE")/$(cli_getRepoName $FORMAT -d) + + # Check existence of source file. + cli_checkFiles $SOURCE + + # Check existence of target directory. + if [[ ! -d $TARGET ]];then + mkdir -p $TARGET + fi + + # Redifine file path to add file and its type. + TARGET=${TARGET}/$(cli_getRepoName $FILE -f).${FORMAT} + + # Move file into its final location. + cli_printMessage "$TARGET" --as-movedto-line + mv ${SOURCE} ${TARGET} + + done + +} diff --git a/Scripts/Bash/Functions/Render/render.sh b/Scripts/Bash/Functions/Render/render.sh new file mode 100755 index 0000000..98b4180 --- /dev/null +++ b/Scripts/Bash/Functions/Render/render.sh @@ -0,0 +1,139 @@ +#!/bin/bash +# +# render.sh -- This function initializes rendition variables and +# actions to centos-art.sh script. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function render { + + local ACTIONNAM='' + local ACTIONVAL='' + + # Initialize `--releasever' option. The release version option + # controls the release number used to produce release-specific + # content. By default, the release number of The CentOS + # Distribution you have installed in your workstation is used. + local FLAG_RELEASEVER=$(cat /etc/redhat-release \ + | gawk '{ print $3 }') + + # Initialize `--basearch' option. The base architecture option + # controls the architecture type used to produce + # architecture-specific content. By default, the hardware + # platform of your workstation is used. + local FLAG_BASEARCH=$(uname -i) + + # Initialize `--theme-model' option. The theme model option + # specifies the the theme model name used to produce theme + # artistic motifs. + local FLAG_THEME_MODEL='Default' + + # Initialize `--post-rendition' option. This option defines what + # command to use as post-rendition. Post-rendition takes palce + # over base-rendition output. + local FLAG_POSTRENDITION='' + + # Initialize `--last-rendition' option. This option defines what + # command to use as last-rendition. Last-rendition takes palce + # once both base-rendition and post-rendition has been performed + # in the same directory structure. + local FLAG_LASTRENDITION='' + + # Initialize `--dont-dirspecific' option. This option can take two + # values only (e.g., `true' or `false') and controls whether to + # perform or not directory-specific rendition. Directory-specific + # rendition may use any of the three types of renditions (e.g., + # base-rendition, post-rendition and last-rendition) to accomplish + # specific tasks when specific directory structures are detected + # in the rendition flow. By default, the centos-art.sh script + # performs directory-specific rendition. + local FLAG_DONT_DIRSPECIFIC='false' + + # Initialize `--with-brands' option. This option controls whether + # to brand output images or not. By default output images are not + # branded. + local FLAG_WITH_BRANDS='false' + + # Initialize name of rendition backend as an empty value. The name + # of rendition backend is determined automatically based on + # template file extension, later, at rendition time. + local RENDER_BACKEND='' + + # Initialize absolute path to backend's base directory, the place + # where backend-specific directories are stored in. + local RENDER_BACKEND_DIR="${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}" + + # Initialize list of supported file extensions. These file + # extensions are used by design model files, the files used as + # base-rendition input. In order for design model files to be + # correclty rendered, they must end with one of the file + # extensions listed here. + local RENDER_EXTENSIONS='svg docbook' + + # Interpret arguments and options passed through command-line. + render_getOptions + + # Redefine positional parameters using ARGUMENTS. At this point, + # option arguments have been removed from ARGUMENTS variable and + # only non-option arguments remain in it. + eval set -- "$ARGUMENTS" + + # Define action value. We use non-option arguments to define the + # action value (ACTIONVAL) variable. + for ACTIONVAL in "$@";do + + # Check action value. Be sure the action value matches the + # convenctions defined for source locations inside the working + # copy. + ACTIONVAL=$(cli_checkRepoDirSource "$ACTIONVAL") + + # Syncronize changes between repository and working copy. At + # this point, changes in the repository are merged in the + # working copy and changes in the working copy committed up to + # repository. + cli_syncroRepoChanges + + # Define renderable directories and the way they are produced. + # To describe the way renderable directories are produced, we + # take the action value (ACTIONVAL) as reference and describe + # the production through an action name (ACTIONNAM). + if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/Images/Themes" ]];then + ACTIONNAM="render_doThemeActions" + elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/Images" ]];then + ACTIONNAM="render_doBaseActions" + elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Manuals" ]];then + ACTIONNAM="render_doBaseActions" + else + cli_printMessage "`gettext "The path provided doesn't support rendition."`" --as-error-line + fi + + # Execute action name. + ${ACTIONNAM} + + # Syncronize changes between repository and working copy. At + # this point, changes in the repository are merged in the + # working copy and changes in the working copy committed up to + # repository. + cli_syncroRepoChanges + + done + +} diff --git a/Scripts/Bash/Functions/Render/render_doBaseActions.sh b/Scripts/Bash/Functions/Render/render_doBaseActions.sh new file mode 100755 index 0000000..fbcad50 --- /dev/null +++ b/Scripts/Bash/Functions/Render/render_doBaseActions.sh @@ -0,0 +1,244 @@ +#!/bin/bash +# +# render_doBaseActions.sh -- This function performs base-rendition +# action for all files. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function render_doBaseActions { + + local -a FILES + local FILE='' + local OUTPUT='' + local TEMPLATE='' + local TEMPLATE_HAS_DOCTYPE='' + local PARENTDIR='' + local TRANSLATION='' + local EXTERNALFILE='' + local EXTERNALFILES='' + local THIS_FILE_DIR='' + local NEXT_FILE_DIR='' + local RENDER_EXTENSION='' + local COUNT=0 + + # Verify default directory where design models are stored in. + cli_checkFiles "$(cli_getRepoTLDir)/Identity/Models/Themes/${FLAG_THEME_MODEL}" --directory + + # Redefine parent directory for current workplace. + PARENTDIR=$(basename "${ACTIONVAL}") + + # Define base location of template files. + render_getDirTemplate + + # Loop through list of supported file extensions. + for RENDER_EXTENSION in ${RENDER_EXTENSIONS};do + + # Redefine name of rendition backend based on supported file + # extension. + if [[ $RENDER_EXTENSION =~ '^(svg|docbook)$' ]];then + RENDER_BACKEND=${RENDER_EXTENSION} + else + cli_printMessage "`eval_gettext "The \\\"\\\$RENDER_EXTENSION\\\" file extension is not supported yet."`" --as-error-line + fi + + # Define the list of files to process. Use an array variable + # to store the list of files to process. This make posible to + # realize verifications like: is the current base directory + # equal to the next one in the list of files to process? + # Questions like this is let us to know when centos-art.sh is + # leaving a directory structure and entering another. This + # information is required in order for centos-art.sh to know + # when to apply last-rendition actions. + # + # Another issue is that some directories might be named as if + # they were files (e.g., using a renderable extension like + # .docbook). In these situations we need to avoid such + # directories from being interpreted as a renderable file. For + # this, pass the `--type="f"' option when building the list of + # files to process in order to retrive regular files only. + # + # Another issue to consider here, is that in some cases both + # templates and outputs might be in the same location. In + # these cases localized content are stored in the same + # location where template files are retrived from and we need + # to avoid using localized content from being interpreted as + # design models. In that sake, supress language-specific files + # from the list of files to process. + # + # Another issue to consider here, is the way of filtering. We + # cannot expand the pattern specified by FLAG_FILTER with a + # `.*' here (e.g., "${FLAG_FILTER}.*\.${RENDER_EXTENSION}") + # because that would suppress any possibility from the user to + # specifiy just one file name in locations where more than one + # file with the same name as prefix exists (e.g., + # `repository.docbook', `repository-preamble.docbook' and + # `repository-parts.docbook'). Instead, pass filtering + # control to the user whom can use regular expression markup + # in the `--filter' option to decide whether to match + # `repository.docbook' only (e.g., through + # `--filter="repository"') or `repository-preamble.docbook' + # and `repository-parts.docbook' but not `repository.docbook' + # (e.g., through `--filter="repository-.*"'). + for FILE in $(cli_getFilesList ${TEMPLATE} \ + --pattern="${FLAG_FILTER}\.${RENDER_EXTENSION}" --type="f" \ + | egrep -v '/[[:alpha:]]{2}_[[:alpha:]]{2}/');do + FILES[((++${#FILES[*]}))]=$FILE + done + + # Verify list of files to process. Assuming no file is found, + # evaluate the next supported file extension. + if [[ ${#FILES[*]} -eq 0 ]];then + continue + fi + + # Initialize backend-specific functionalities. + cli_exportFunctions "${RENDER_BACKEND_DIR}/$(cli_getRepoName \ + ${RENDER_BACKEND} -d)" "${RENDER_BACKEND}" + + # Start processing the base rendition list of FILES. Fun part + # approching :-). + while [[ $COUNT -lt ${#FILES[*]} ]];do + + # Define base file. + FILE=${FILES[$COUNT]} + + # Define the base directory path for the current file being + # process. + THIS_FILE_DIR=$(dirname ${FILES[$COUNT]}) + + # Define the base directory path for the next file that will + # be process. + if [[ $(($COUNT + 1)) -lt ${#FILES[*]} ]];then + NEXT_FILE_DIR=$(dirname ${FILES[$(($COUNT + 1))]}) + else + NEXT_FILE_DIR='' + fi + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Define final location of translation file. + TRANSLATION=$(dirname $FILE \ + | sed -r 's!trunk/(Manuals|Identity)!trunk/L10n/\1!')/$(cli_getCurrentLocale)/messages.po + + # Define final location of template file. + TEMPLATE=${FILE} + + # Verify design models file existence. We cannot continue + # with out it. + if [[ ! -f $TEMPLATE ]];then + cli_printMessage "`gettext "The template file doesn't exist."`" --as-error-line + fi + + # Verify whether the design model uses DOCTYPE definition + # or not; and redefine related variable for further using. + egrep '^ /dev/null + TEMPLATE_HAS_DOCTYPE=$? + + # Validate design model before processing it. This step is + # very important in order to detect document's + # malformations and warn you about it, so you can correct + # them before processing the document as input. Notice + # that, here, validation is possible only for documents + # which have a DOCTYPE definition inside. + if [[ $TEMPLATE_HAS_DOCTYPE -eq 0 ]];then + + # Print action message. + cli_printMessage "$TEMPLATE" --as-validating-line + + # Validate document before processing it. + xmllint --valid --noent --noout $TEMPLATE + if [[ $? -ne 0 ]];then + cli_printMessage "`gettext "Validation failed."`" --as-error-line + fi + + else + # Print action message. + cli_printMessage "$TEMPLATE" --as-template-line + fi + + # Define final location of output directory. + render_getDirOutput + + # Get relative path to file. The path string (stored in + # FILE) has two parts: 1. the variable path and 2. the + # common path. The variable path is before the common + # point in the path string. The common path is after the + # common point in the path string. The common point is the + # name of the parent directory (stored in PARENTDIR). + # + # Identity/Models/Themes/.../Firstboot/3/splash-small.svg + # -------------------------^| the |^------------^ + # variable path | common | common path + # -------------------------v| point | v------------v + # Identity/Images/Themes/.../Firstboot/Img/3/splash-small.png + # + # What we do here is remove the varibale path, the common + # point, and the file extension parts in the string + # holding the path retrived from design models directory + # structure. Then we use the common path as relative path + # to store the the final image file. + # + # The file extension is removed from the common path + # because it is set when we create the final image file. + # This configuration let us use different extensions for + # the same file name. + # + # When we render using base-rendition action, the + # structure of files under the output directory will be + # the same used after the common point in the related + # design model directory structure. + FILE=$(echo ${FILE} \ + | sed -r "s!.*${PARENTDIR}/!!" \ + | sed -r "s/\.${RENDER_EXTENSION}$//") + + # Define absolute path to final file (without extension). + FILE=${OUTPUT}/$(basename "${FILE}") + + # Define instance name from design model. + INSTANCE=$(cli_getTemporalFile ${TEMPLATE}) + + # Apply translation file to design model to produce the design + # model translated instance. + render_doTranslation + + # Expand translation markers inside design model instance. + cli_expandTMarkers ${INSTANCE} + + # Perform backend base-rendition. + ${RENDER_BACKEND} + + # Remove template instance. + if [[ -f $INSTANCE ]];then + rm $INSTANCE + fi + + # Increment file counter. + COUNT=$(($COUNT + 1)) + + done + + # Unset backend-specific functionalities. + cli_unsetFunctions "${RENDER_BACKEND_DIR}/$(cli_getRepoName \ + ${RENDER_BACKEND} -d)" "${RENDER_BACKEND}" + + done +} diff --git a/Scripts/Bash/Functions/Render/render_doThemeActions.sh b/Scripts/Bash/Functions/Render/render_doThemeActions.sh new file mode 100755 index 0000000..df0db5e --- /dev/null +++ b/Scripts/Bash/Functions/Render/render_doThemeActions.sh @@ -0,0 +1,135 @@ +#!/bin/bash +# +# render_doThemeActions.sh -- This function performs theme-specific +# rendition. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function render_doThemeActions { + + local -a DIRS + local COUNT=0 + local NEXT_DIR='' + local MOTIF_NAME='' + local MOTIF_DIR='' + + # Define base directory of artistic motifs. This is the location + # where all artistic motifs are stored in. + local MOTIF_BASEDIR="$(cli_getRepoTLDir $ACTIONVAL)/Identity/Images/Themes" + + # Define base directory of design models. This is the location + # where all design models are stored in. + local MODEL_BASEDIR="$(cli_getRepoTLDir $ACTIONVAL)/Identity/Models/Themes" + + # Define directory structure of design models. Design models + # directory structures are used as reference to create artistic + # motifs directory structure. Use the `--pattern' option to be + # sure any modification to FLAG_FILTER won't affect the output + # result. We need to make matching everything here, no matter what + # the FLAG_FILTER value be. + local MODEL_DIR='' + local MODEL_DIRS="$(cli_getFilesList ${MODEL_BASEDIR}/${FLAG_THEME_MODEL} \ + --pattern=".+" --type="d" | egrep -v '\.svn' | sed -r '/^[[:space:]]*$/d' | sed -r \ + "s!^.*/${FLAG_THEME_MODEL}/!!" | sed -r '/^[[:space:]]*$/d')" + + # Define design model regular expression patterns from design + # models directory structure. + local MODEL_PATTERN=$(echo "$MODEL_DIRS" | tr "\n" '|' \ + | sed -e 's!^|!!' -e 's!|$!!') + + # Define list of renderable directory structures inside the + # artistic motif. As reference, to build this list, use design + # model directory structure. Later, filter the result using the + # action value as reference to control what renderable directory + # structure to produce. The more specific you be in the path + # specification the more specific theme rendition will be. + local MOTIF_RENDERABLE_DIR='' + local MOTIF_RENDERABLE_DIRS=$(cli_getFilesList ${MOTIF_BASEDIR} \ + --pattern=".+/($MODEL_PATTERN)" --type="d" | grep "$ACTIONVAL") + + # Rebuild list of renderable directory structures using an array + # variable. This let us to predict what directory is one step + # forward or backward from the current directory structure. + for MOTIF_RENDERABLE_DIR in $MOTIF_RENDERABLE_DIRS;do + DIRS[((++${#DIRS[*]}))]=${MOTIF_RENDERABLE_DIR} + done + + # Define total number of directories to process. This is required + # in order to correct the counting value and so, make it to match + # the zero based nature of bash array variables. + local DIRS_TOTAL=$((${#DIRS[*]} - 1)) + + while [[ $COUNT -le ${DIRS_TOTAL} ]];do + + # Redefine action value to refer the theme-specific renderable + # directory. + ACTIONVAL=${DIRS[$COUNT]} + + # Refine artistic motif name using the current action value. + MOTIF_NAME=$(cli_getPathComponent $ACTIONVAL --motif) + + # Verify artistic motif name. The name of the artistic motif + # must be present in order for theme rendition to happen. + # Theme rendition takes place inside artistic motifs and the + # artistic motif name is an indispensable part of it. Take + # care of not using design models directory structure as name + # for artistic motifs. They, sometimes, match the pattern used + # to verify artistic motifs names but must not be confused. + if [[ $MOTIF_NAME == '' ]] || [[ $MOTIF_NAME =~ "^$MODEL_PATTERN" ]];then + COUNT=$(($COUNT + 1)) + continue + fi + + # Refine artistic motif directory. This is the top directory + # where all visual manifestations of an artistic motif are + # stored in (e.g., Backgrounds, Brushes, Concept, Distro, + # etc.). + MOTIF_DIR="${MOTIF_BASEDIR}/${MOTIF_NAME}" + + # Define what is the next directory in the list, so we could + # verify whether to render or not the current theme-specific + # renderable directory. + if [[ $COUNT -lt ${DIRS_TOTAL} ]];then + NEXT_DIR=$(dirname ${DIRS[(($COUNT + 1))]}) + else + NEXT_DIR='' + fi + + # Verify whether to render or not the current theme's + # renderable directory. This verification is needed in order + # to avoid unncessary rendition loops. For example, don't + # render `path/to/dir/A' when `path/to/dir/A/B' does exist, + # that configuration would produce `/path/to/dir/A/B twice. + if [[ $ACTIONVAL =~ '[[:digit:]]$' ]] || [[ $ACTIONVAL == $NEXT_DIR ]];then + COUNT=$(($COUNT + 1)) + continue + fi + + # Execute direct rendition on theme specific renderable + # directory as specified by action value. + render_doBaseActions + + # Increment counter to match the correct count value. + COUNT=$(($COUNT + 1)) + + done + +} diff --git a/Scripts/Bash/Functions/Render/render_doTranslation.sh b/Scripts/Bash/Functions/Render/render_doTranslation.sh new file mode 100755 index 0000000..d473f5c --- /dev/null +++ b/Scripts/Bash/Functions/Render/render_doTranslation.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# render_doTranslation.sh -- This function standardizes the way +# translation files are applied to design models in order to produce +# the translated instance that is used to expand translation markers +# and produce the base-rendition output. +# +# Assuming no translation file exists, the an untranslated instace +# from the design model is created (i.e., just a copy of it). Using a +# design model instance (translated or not) is required in order to +# expand translation markers safetly. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function render_doTranslation { + + # Verify translation file existence and create template + # instance accordingly. + if [[ -f ${TRANSLATION} ]];then + + # Print final location of translation file. + cli_printMessage "${TRANSLATION}" --as-translation-line + + # Create the translated instance of design model based on + # whether the template file has DOCTYPE definition or not. + if [[ ${TEMPLATE_HAS_DOCTYPE} -eq 0 ]];then + xmllint --valid --noent ${TEMPLATE} \ + | xml2po -a -l $(cli_getCurrentLocale) -p ${TRANSLATION} -o ${INSTANCE} - + else + xml2po -a -l $(cli_getCurrentLocale) -p ${TRANSLATION} -o ${INSTANCE} ${TEMPLATE} + fi + + # Remove .xml2po.mo temporal file. + if [[ -f ${PWD}/.xml2po.mo ]];then + rm ${PWD}/.xml2po.mo + fi + + else + + # Create the non-translated instance of design model. + if [[ ${TEMPLATE_HAS_DOCTYPE} -eq 0 ]];then + xmllint --valid --noent ${TEMPLATE} > ${INSTANCE} + else + cp ${TEMPLATE} ${INSTANCE} + fi + + fi + + # Verify instance existence. + cli_checkFiles $INSTANCE + +} diff --git a/Scripts/Bash/Functions/Render/render_getConfigOption.sh b/Scripts/Bash/Functions/Render/render_getConfigOption.sh new file mode 100755 index 0000000..c79d864 --- /dev/null +++ b/Scripts/Bash/Functions/Render/render_getConfigOption.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# +# render_getConfigOption.sh -- This function standardizes the +# configuration fields are retrived from some action-specific +# definitions. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function render_getConfigOption { + + # Initialize action string. + local ACTION="$1" + + # Initialize field definition. + local FIELD="$2" + + # Initialize configuration options. + local OPTION='' + + # Check action string. The action string must be present in order + # for this function to work. It provides the information needed to + # retrive configurantion options from. + if [[ "$ACTION" == '' ]];then + cli_printMessage "`gettext "There is no action string to work with."`" --as-error-line + fi + + # Check field definition. The field definition must match any of + # the formats specified by the `-f' option of `cut' command. + if [[ ! "$FIELD" =~ '^([0-9]+|[0-9]+-|-[0-9]+|[0-9]+-[0-9]+)$' ]];then + cli_printMessage "`gettext "The field definition is not valid."`" --as-error-line + fi + + # Get configuration option from action string. + OPTION=$(echo -n "$ACTION" | cut -d: -f${FIELD}) + + # Sanitate configuration option retrived from action string. + OPTION=$(echo -n "${OPTION}" \ + | sed -r 's!^ *!!g' \ + | sed -r 's!( |,|;) *! !g' \ + | sed -r 's! *$!!g') + + # Print out the configuration option retrived from action string, + # only if it is not an empty value. Do not use `echo' or `printf' + # built-in commands here. Use the `cli_printMessage' functionality + # instead. This is required in order to reverse the apostrophe + # codification accomplished when options were retrived from + # command-line (cli_parseArgumentsReDef) in the argument of + # options like `--post-rendition' and `--last-rendition'. + if [[ $OPTION != '' ]];then + cli_printMessage "$OPTION" --as-stdout-line + fi + +} diff --git a/Scripts/Bash/Functions/Render/render_getDirOutput.sh b/Scripts/Bash/Functions/Render/render_getDirOutput.sh new file mode 100755 index 0000000..8796d8f --- /dev/null +++ b/Scripts/Bash/Functions/Render/render_getDirOutput.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# +# render_getDirOutput.sh -- This function defines the final +# absolute path the centos-art.sh script uses to store identity +# contents produced at rendition time. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function render_getDirOutput { + + # Define base output directory using design model path as + # reference. + OUTPUT=$(dirname $FILE | sed -r \ + -e "s!/Themes/${FLAG_THEME_MODEL}!/Themes/$(cli_getPathComponent $ACTIONVAL --motif)!" \ + -e "s!/Models!/Images!" \ + -e "s!/Tpl!!") + + # By default rendered identity content is stored immediatly under + # identity entry structure, but if `Img/' directory exists use it + # instead. + if [[ -d "${OUTPUT}/Img" ]];then + OUTPUT=${OUTPUT}/Img + fi + + # Redefine base output directory to introduce specific information + # like release number and architecture. This information is + # require by directories (e.g., the `Media' directory inside + # themes and the `trunk/Manuals/Distro' directory ) whose need + # this information to be passed explicitly at the command-line + # through the `--releasever' and `--basearch' options. Other + # directories take such information from the path they are stored + # in (e.g., the `Distro/5/Anaconda' directory inside themes.). So, + # we need to differentiate the way information like release + # numbers and architectures are retrived in order to build the + # output path correctly at rendition time. + if [[ $OUTPUT =~ "^${MOTIF_DIR}/Media$" ]];then + OUTPUT=${OUTPUT}/${FLAG_RELEASEVER}/${FLAG_BASEARCH} + elif [[ $OUTPUT =~ 'trunk/Manuals/Distro$' ]];then + OUTPUT=${OUTPUT}/${FLAG_RELEASEVER} + else + OUTPUT=${OUTPUT} + fi + + # Define whether to use or not locale-specific directory to store + # content, using current locale information as reference. As + # convenction, when we produce content, only specific locations + # use locale-specific directories to organize language-specific + # content (e.g., Manuals, Anaconda, Installation media, etc.). All + # other locations do not use locale-specific directories to + # organize content. This convenction is important in order for + # the `prepare' functionality of centos-art.sh script to produce + # content in the correct location. Otherwise, we might end up + # duplicating content (e.g., icons, brands, etc.) which doesn't + # have any translation, nor any need to be translated. + if [[ ! $(cli_getCurrentLocale) =~ '^en' ]];then + if [[ $(cli_isLocalized $TEMPLATE) == 'true' ]];then + OUTPUT=${OUTPUT}/$(cli_getCurrentLocale) + fi + fi + + # Create final output directory, if it doesn't exist yet. + if [[ ! -d ${OUTPUT} ]];then + mkdir -p ${OUTPUT} + fi + +} diff --git a/Scripts/Bash/Functions/Render/render_getDirTemplate.sh b/Scripts/Bash/Functions/Render/render_getDirTemplate.sh new file mode 100755 index 0000000..1b0c2de --- /dev/null +++ b/Scripts/Bash/Functions/Render/render_getDirTemplate.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# +# render_getDirTemplate.sh -- This function defines the way renderable +# directories are processed inside the repository. Inside the +# repository, renderable directories are processed either through +# direct or theme-specific rendition. +# +# Direct rendition takes one XML file from design model +# (`trunk/Identity/Models') directory structure and produces one file +# in `trunk/Identity/Images' directory strucutre. In this +# configuration, the organization used to stored the design model is +# taken as reference to build the path required to store the image +# related to it under `trunk/Identity/Images' directory structure. +# +# Theme-specific rendition takes one design model from +# `trunk/Identity/Models/Themes' directory structure to produce one or +# more images in `trunk/Identity/Images/Themes/$THEME/$VERSION/$MODEL' +# directory structure. In this configuration we have many different +# artistic motifs that use one unique design model directory structure +# as reference to produce images. +# +# Since theme design models are unified to be reused by more +# than one artistic motif, it is not possible to render artistic +# motifs in a lineal manner (i.e., as we do with direct rendition) +# because we need to establish the relation between the artistic motif +# renderable directory structure and the design model first and that +# relation happens when renderable directory structures inside +# artistic motifs are processed individually. +# +# In the first rendition category, we use a design model directory +# structure as reference to produce images one by one. In the second +# rendition category, we can't use the same procedure because one +# design model directory structure is used to produce several +# renderable directory structures, not just one. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function render_getDirTemplate { + + # Initialize design models location used as reference to process + # renderable directory structures. + TEMPLATE=$ACTIONVAL + + # Sanitate design models location. Be sure design models do + # always point to trunk directory structure. This is useful to let + # `centos-art.sh' script do rendition under branches directory + # structure, reusing design models under trunk directory + # structure. + TEMPLATE=$(echo "$TEMPLATE" | sed "s!/branches/!/trunk/!") + + # Define absolute path to input files using absolute path from + # output files. + if [[ -d ${TEMPLATE}/Tpl ]];then + TEMPLATE=${TEMPLATE}/Tpl + else + TEMPLATE=$(echo "$TEMPLATE" | sed -r \ + -e "s!/Themes/$(cli_getPathComponent $ACTIONVAL --motif)!/Themes/${FLAG_THEME_MODEL}!" \ + -e "s!/Images!/Models!") + fi + + # Verify absolute path to input file. This verification is + # specially needed in those situations when the artistic motif + # directory structure has an organization different to that in + # design models directory structure. Since the path to design + # models is built from artistic motif directory structure, if + # artistic motifs directory structure is different from design + # model directory structure, as result we'll have a path to a + # design model that may not exist and that would make + # centos-art.sh script to fail. So, verify the absolute path to + # the input file and stop script execution if it doesn't exist. + cli_checkFiles $TEMPLATE + +} diff --git a/Scripts/Bash/Functions/Render/render_getOptions.sh b/Scripts/Bash/Functions/Render/render_getOptions.sh new file mode 100755 index 0000000..3464f6f --- /dev/null +++ b/Scripts/Bash/Functions/Render/render_getOptions.sh @@ -0,0 +1,133 @@ +#!/bin/bash +# +# render_getOptions.sh -- This function interprets option parameters +# passed to `render' functionality and calls actions accordingly. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function render_getOptions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="filter:,quiet,answer-yes,dont-commit-changes,dont-dirspecific,releasever:,basearch:,post-rendition:,last-rendition:,theme-model:,with-brands" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + + case "$1" in + + --filter ) + FLAG_FILTER="$2" + shift 2 + ;; + + --quiet ) + FLAG_QUIET="true" + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + --answer-yes ) + FLAG_ANSWER="true" + shift 1 + ;; + + --dont-commit-changes ) + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + --dont-dirspecific ) + FLAG_DONT_DIRSPECIFIC="true" + shift 1 + ;; + + --post-rendition ) + FLAG_POSTRENDITION="$2" + shift 2 + ;; + + --last-rendition ) + FLAG_LASTRENDITION="$2" + shift 2 + ;; + + --basearch ) + FLAG_BASEARCH="$2" + if [[ ! $FLAG_BASEARCH =~ $(cli_getPathComponent --architecture-pattern) ]];then + cli_printMessage "`gettext "The architecture provided is not supported."`" --as-error-line + fi + shift 2 + ;; + + --releasever ) + FLAG_RELEASEVER="$2" + if [[ ! $FLAG_RELEASEVER =~ $(cli_getPathComponent --release-pattern) ]];then + cli_printMessage "`gettext "The release version provided is not supported."`" --as-error-line + fi + shift 2 + ;; + + --theme-model ) + FLAG_THEME_MODEL=$(cli_getRepoName $2 -d) + shift 2 + ;; + + --with-brands ) + FLAG_WITH_BRANDS='true' + shift 1 + ;; + + -- ) + # Remove the `--' argument from the list of arguments + # in order for processing non-option arguments + # correctly. At this point all option arguments have + # been processed already but the `--' argument still + # remains to mark ending of option arguments and + # begining of non-option arguments. The `--' argument + # needs to be removed here in order to avoid + # centos-art.sh script to process it as a path inside + # the repository, which obviously is not. + shift 1 + break + ;; + esac + done + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Verify non-option arguments passed to command-line. If there + # isn't any, redefine the ARGUMENTS variable to use the current + # location the functionality was called from. + if [[ $ARGUMENTS == '' ]];then + ARGUMENTS=${PWD} + fi + +} diff --git a/Scripts/Bash/Functions/Tuneup/Shell/Config/topcomment.sed b/Scripts/Bash/Functions/Tuneup/Shell/Config/topcomment.sed new file mode 100644 index 0000000..0b3077f --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/Shell/Config/topcomment.sed @@ -0,0 +1,55 @@ +#!/bin/sed +# +# topcomment.sed -- This file standardizes the top comment inside +# centos-art.sh scripts. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- +/^# +Copyright .*$/a\ +# Copyright (C) =COPYRIGHT_YEAR_LIST= =COPYRIGHT_HOLDER=\ +#\ +# 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, write to the Free Software\ +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\ +#\ +# ---------------------------------------------------------------------- + +# Remove previous copyright notice, just to be sure the one above be +# used always. +/^# +Copyright .*$/,/^# -{70}$/{ +d +} + +# Remove more than one space after comments. +s/^# +/# / + +# Define script first line. +1c\ +#!/bin/bash diff --git a/Scripts/Bash/Functions/Tuneup/Shell/shell.sh b/Scripts/Bash/Functions/Tuneup/Shell/shell.sh new file mode 100755 index 0000000..da719b2 --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/Shell/shell.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# shell.sh -- This function standardizes maintainance tasks for Shell +# script files. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function shell { + + # Rebuild top comment inside shell scripts, mainly to update + # copyright information. + shell_doTopComment + +} diff --git a/Scripts/Bash/Functions/Tuneup/Shell/shell_doTopComment.sh b/Scripts/Bash/Functions/Tuneup/Shell/shell_doTopComment.sh new file mode 100755 index 0000000..259e948 --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/Shell/shell_doTopComment.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# +# shell_doTopComment.sh -- This function standardizes the top comment +# section inside shell scripts (*.sh) using a predefined template. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function shell_doTopComment { + + # Define absolute path to template file. + local TEMPLATE="${TUNEUP_CONFIG_DIR}/topcomment.sed" + + # Check template file existence. + cli_checkFiles $TEMPLATE + + # Define file name to template instance. + local INSTANCE=$(cli_getTemporalFile $TEMPLATE) + + # Create template instance. + cp $TEMPLATE $INSTANCE + + # Check template instance. We cannot continue if template instance + # couldn't be created. + cli_checkFiles $INSTANCE + + # Expand translation markers in template instance. + cli_expandTMarkers $INSTANCE + + # Apply template instance to file. + sed -r -i -f $INSTANCE $FILE + + # Remove template instance. + if [[ -f ${INSTANCE} ]];then + rm ${INSTANCE} + fi + +} diff --git a/Scripts/Bash/Functions/Tuneup/Svg/Config/metadata.sed b/Scripts/Bash/Functions/Tuneup/Svg/Config/metadata.sed new file mode 100644 index 0000000..199c44d --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/Svg/Config/metadata.sed @@ -0,0 +1,64 @@ +# This file is the metadata information used by CentOS Artwork SIG on +# its scalable vector graphics (SVG) files. This files is used with +# the regular expression '.*\.svg$' only. +# --------------------------------------------------- +# $Id$ +# --------------------------------------------------- +/\ + \ + \ + image/svg+xml\ + \ + \ + =TITLE=\ + =DATE=\ + \ + \ + =COPYRIGHT_HOLDER=\ + \ + \ + \ + \ + =COPYRIGHT_HOLDER=\ + \ + \ + \ + \ + =COPYRIGHT_HOLDER=\ + \ + \ + =URL=\ + =URL=\ + =URL=\ + =LOCALE=\ + \ + \ +=KEYWORDS=\ + \ + \ + =COPYRIGHT_HOLDER=\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + diff --git a/Scripts/Bash/Functions/Tuneup/Svg/svg.sh b/Scripts/Bash/Functions/Tuneup/Svg/svg.sh new file mode 100755 index 0000000..b3e55d0 --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/Svg/svg.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# svg.sh -- This function standardizes maintainance of SVG files. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg { + + # Update metadata information. + svg_doMetadata + + # Remove all unused items. + svg_doVacuumDefs + +} diff --git a/Scripts/Bash/Functions/Tuneup/Svg/svg_doMetadata.sh b/Scripts/Bash/Functions/Tuneup/Svg/svg_doMetadata.sh new file mode 100755 index 0000000..da58c2f --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/Svg/svg_doMetadata.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# +# svg_doMetadata.sh -- This function updates metadata values inside +# scalable vector graphic (SVG) files using default values from The +# CentOS Project. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_doMetadata { + + # Define template file name. + local TEMPLATE="${TUNEUP_CONFIG_DIR}/metadata.sed" + + # Check template file existence. + cli_checkFiles $TEMPLATE + + # Build title from file path. + local TITLE=$(basename "$FILE") + + # Build url from file path. + local URL=$(echo $FILE | sed 's!/home/centos!https://projects.centos.org/svn!') + + # Build keywords from file path. Do not include filename, it is + # already on title. + local KEY='' + local KEYS=$(dirname "$FILE" | cut -d/ -f6- | tr '/' '\n') + + # Build keywords using SVG standard format. Note that this + # information is inserted inside template file. The template file + # is a replacement set of sed commands so we need to escape the + # new line of each line using one backslash (\). As we are doing + # this inside bash, it is required to escape the backslash with + # another backslash so one of them passes literally to template + # file. + KEYS=$(\ + for KEY in $KEYS;do + echo " $KEY\\" + done) + + # Redefine template instance file name. + local INSTANCE=$(cli_getTemporalFile $TEMPLATE) + + # Create instance. + cp $TEMPLATE $INSTANCE + + # Check template instance. We cannot continue if the template + # instance couldn't be created. + cli_checkFiles $INSTANCE + + # Expand translation markers inside template instance. + sed -r -i \ + -e "s!=TITLE=!$TITLE!" \ + -e "s!=URL=!$URL!" \ + -e "s!=DATE=!$(date "+%Y-%m-%d")!" $INSTANCE + sed -i -r "/=KEYWORDS=/c\\${KEYS}" $INSTANCE + sed -i -r 's/>$/>\\/g' $INSTANCE + cli_expandTMarkers $INSTANCE + + # Update scalable vector graphic using template instance. + sed -i -f $INSTANCE $FILE + + # Remove template instance. + if [[ -f $INSTANCE ]];then + rm $INSTANCE + fi + + # Sanitate scalable vector graphic. + sed -i -r '/^[[:space:]]*$/d' $FILE + +} diff --git a/Scripts/Bash/Functions/Tuneup/Svg/svg_doVacuumDefs.sh b/Scripts/Bash/Functions/Tuneup/Svg/svg_doVacuumDefs.sh new file mode 100755 index 0000000..3a4ac2f --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/Svg/svg_doVacuumDefs.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# svg_doVacuumDefs.sh -- This function removes all unused items from +# the defs section of the SVG file. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_doVacuumDefs { + + # Vacuum unused svg definition using inkscape. + inkscape --vacuum-defs $FILE &> /dev/null + +} diff --git a/Scripts/Bash/Functions/Tuneup/Xhtml/Config/toc.awk b/Scripts/Bash/Functions/Tuneup/Xhtml/Config/toc.awk new file mode 100644 index 0000000..69c668f --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/Xhtml/Config/toc.awk @@ -0,0 +1,79 @@ +#!/usr/bin/gawk +# +# toc.awk -- This file provides the output format required by +# `xhtml_makeToc' function, inside centos-art.sh script, to produce +# the table of contents correctly. +# +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Pubdtc License as pubdtshed 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 usefdl, but +# WITHOUT ANY WARRANTY; without even the impdted warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Pubdtc License for more details. +# +# You shodld have received a copy of the GNU General Pubdtc License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +BEGIN {FS=":"} + +{ + if ($1 == 0 && $2 == $3) { + opentags = "
" + closetags = "" + } + + if ($1 > 0 && $2 > $3) { + opentags = "
" + closetags = "" + } + + if ($1 > 0 && $2 == $3) { + opentags = "
" + closetags = "" + } + + if ($1 > 0 && $2 < $3) { + opentags = "" + for (i = 1; i <= ($3 - $2); i++) { + opentags = opentags "
" + closetags = "" + } + opentags = opentags "
" + } + + printf "%s%s%s\n",opentags,$4,closetags + +} + +END { + + if ($1 > 0 && $2 >= $3 && $3 > 1) { + for (i = 1; i <= $3; i++) { + print "
" + } + } + + if ($1 > 0 && $2 >= $3 && $3 == 1) { + print "" + print "" + } + + if ($1 > 0 && $2 < $3) { + for (i = 1; i <= $2; i++) { + print "" + } + } + + print "" +} diff --git a/Scripts/Bash/Functions/Tuneup/Xhtml/xhtml.sh b/Scripts/Bash/Functions/Tuneup/Xhtml/xhtml.sh new file mode 100755 index 0000000..201401a --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/Xhtml/xhtml.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# xhtml.sh -- This function standardizes maintainance tasks of XHTML +# files. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function xhtml { + + # Transforms xhtml headings to make them accessible (e.g., through + # a table of contents). + xhtml_doToc + +} diff --git a/Scripts/Bash/Functions/Tuneup/Xhtml/xhtml_doToc.sh b/Scripts/Bash/Functions/Tuneup/Xhtml/xhtml_doToc.sh new file mode 100755 index 0000000..314a310 --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/Xhtml/xhtml_doToc.sh @@ -0,0 +1,160 @@ +#!/bin/bash +# +# xhtml_doToc.sh -- This functionality transforms web page headings to +# make them accessible through a table of contents. The table of +# contents is expanded in place, wherever the
+# piece of code be in the page. Once the
+# piece of code has be expanded, there is no need to put anything else +# in the page. +# +# In order for the tuneup functionality to transform headings, you +# need to put headings in just one line using one of the following +# forms: +# +#

Title

+#

Title

+#

Title

+# +# In the example above, h1 can vary from h1 to h6. Closing tag must be +# present and also match the openning tag. The value of `name' and +# `href' options from the anchor element are set dynamically using the +# md5sum output of combining the page location, the head- string and +# the heading string. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function xhtml_doToc { + + # Define variables as local to avoid conflicts outside. + local COUNT=0 + local PREVCOUNT=0 + local -a FINAL + local -a TITLE + local -a MD5SM + local -a OPTNS + local -a CLASS + local -a LEVEL + local -a PARENT + local -a TOCENTRIES + local -a LINK + + # Define table of content configuration file, the file used to + # produce the table of content XHTML output code. + local TOC_CONFIG=${TUNEUP_CONFIG_DIR}/toc.awk + + # Verify table of content configuration file. + cli_checkFiles ${TOC_CONFIG} + + # Define html heading regular expression pattern. Use parenthisis + # to save html action name, action value, and heading title. + local PATTERN='(]>)(.*[^<])' + + # Verify list of html files. Are files really html files? If they + # don't, continue with the next one in the list. + if [[ ! $(file --brief $FILE) =~ '^(XHTML|HTML|XML)' ]];then + continue + fi + + # Define list of headings to process. When building the heading, + # it is required to change spaces characters from its current + # decimal output to something different (e.g., its \040 octal + # alternative). This is required because the space character is + # used as egrep default field separator and spaces can be present + # inside heading strings we don't want to separate. + for HEADING in $(egrep "$PATTERN" $FILE \ + | sed -r -e 's!^[[:space:]]+!!' -e "s! !\\\040!g");do + + # Define previous counter value using current counter + # value as reference. + if [[ $COUNT -ne 0 ]];then + PREVCOUNT=$(($COUNT-1)) + fi + + # Define initial heading information. + FIRST[$COUNT]=$(echo $HEADING | sed -r "s!\\\040! !g") + TITLE[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\4!") + MD5SM[$COUNT]=$(echo "${FILE}${FIRST[$COUNT]}" | md5sum | sed -r 's![[:space:]]+-$!!') + OPTNS[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\3!") + CLASS[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\2!") + LEVEL[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\1!") + PARENT[$COUNT]=${LEVEL[$PREVCOUNT]} + + # Transform heading information using initial heading + # information as reference. + if [[ ${OPTNS[$COUNT]} =~ '^$' ]];then + OPTNS[$COUNT]='' + elif [[ ${OPTNS[$COUNT]} =~ '^$' ]];then + OPTNS[$COUNT]='' + elif [[ ${OPTNS[$COUNT]} =~ '^$' ]];then + OPTNS[$COUNT]='' + fi + + # Build final html heading structure. + FINAL[$COUNT]=''${OPTNS[$COUNT]}${TITLE[$COUNT]}'' + + # Build html heading link structure. These links are used by + # the table of contents later. + LINK[$COUNT]=''${TITLE[$COUNT]}'' + + # Build table of contents entry with numerical + # identifications. The numerical identification is what we use + # to determine the correct position of each heading link on + # the table of content. + TOCENTRIES[$COUNT]="$COUNT:${LEVEL[$COUNT]}:${PARENT[$COUNT]}:${LINK[$COUNT]}" + + # Update heading information inside the current file being + # processed. Use the first and final heading information. + sed -i -r "s!${FIRST[$COUNT]}!${FINAL[$COUNT]}!" $FILE + + # Increase heading counter. + COUNT=$(($COUNT + 1)) + + done + + # Build the table of contents using heading numerical + # identifications as reference. The numerical identification + # describes the order of headings in one xhtml file. This + # information is processed by awk to make the appropriate + # replacements. Finnally, the result is stored in the TOC + # variable. + TOC=$(echo '
' + echo "

`gettext "Table of contents"`

" + for TOCENTRY in "${TOCENTRIES[@]}";do + echo $TOCENTRY + done \ + | awk -f ${TOC_CONFIG}) + + # Update table of contents inside the current file being + # processed. + sed -i -r '/
[^<\/div].*<\/div>/c'"$(echo -e $TOC)" $FILE + + # Clean up variables to receive the next file. + unset FINAL + unset TITLE + unset MD5SM + unset OPTNS + unset CLASS + unset LEVEL + unset PARENT + unset TOCENTRIES + unset LINK + +} diff --git a/Scripts/Bash/Functions/Tuneup/tuneup.sh b/Scripts/Bash/Functions/Tuneup/tuneup.sh new file mode 100755 index 0000000..b4a9efb --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/tuneup.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# tuneup.sh -- This function standardizes maintainance tasks for files +# inside the repository. Maintainance tasks are applied to files using +# file extension as reference. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function tuneup { + + local ACTIONNAM='' + local ACTIONVAL='' + + # Initialize name of rendition backend as an empty value. The name + # of rendition backend is determined automatically based on + # template file extension, later, when files are processed. + local TUNEUP_BACKEND='' + + # Initialize absolute path to backend's base directory, the place + # where backend-specific directories are stored in. + local TUNEUP_BASEDIR="${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}" + + # Initialize list of supported file extensions. This is, the file + # extensions we want to perform maintainance tasks for. + local TUNEUP_EXTENSIONS='svg xhtml sh' + + # Interpret arguments and options passed through command-line. + tuneup_getOptions + + # Redefine positional parameters using ARGUMENTS. At this point, + # option arguments have been removed from ARGUMENTS variable and + # only non-option arguments remain in it. + eval set -- "$ARGUMENTS" + + # Define action name. No matter what option be passed to + # centos-art, there is only one action to perform (i.e., build the + # list of files and interpretation of file extensions for further + # processing). + ACTIONNAM="tuneup_doBaseActions" + + # Define action value. We use non-option arguments to define the + # action value (ACTIONVAL) variable. + for ACTIONVAL in "$@";do + + # Check action value. Be sure the action value matches the + # convenctions defined for source locations inside the working + # copy. + ACTIONVAL=$(cli_checkRepoDirSource $ACTIONVAL) + + # Syncronize changes between repository and working copy. At + # this point, changes in the repository are merged in the + # working copy and changes in the working copy committed up to + # repository. + cli_syncroRepoChanges + + # Execute action name. + $ACTIONNAM + + # Syncronize changes between repository and working copy. At + # this point, changes in the repository are merged in the + # working copy and changes in the working copy committed up to + # repository. + cli_syncroRepoChanges + + done + +} diff --git a/Scripts/Bash/Functions/Tuneup/tuneup_doBaseActions.sh b/Scripts/Bash/Functions/Tuneup/tuneup_doBaseActions.sh new file mode 100755 index 0000000..232ee5c --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/tuneup_doBaseActions.sh @@ -0,0 +1,96 @@ +#!/bin/bash +# +# tuneup_doBaseActions.sh -- This function builds one list of files to +# process for each file extension supported and applies maintainance +# tasks file by file for each one of them. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function tuneup_doBaseActions { + + local TUNEUP_CONFIG_DIR='' + local TUNEUP_BACKEND_DIR='' + local TUNEUP_BACKEND_INIT='' + local TUNEUP_EXTENSION='' + local FILE='' + local FILES='' + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Loop through list of supported file extensions. + for TUNEUP_EXTENSION in ${TUNEUP_EXTENSIONS};do + + # Define backend name based on supported file extensions. + TUNEUP_BACKEND="${TUNEUP_EXTENSION}" + + # Define absolute path to directory where backend-specific + # functionalities are stored in. + TUNEUP_BACKEND_DIR="${TUNEUP_BASEDIR}/$(cli_getRepoName \ + ${TUNEUP_BACKEND} -d)" + + # Define absolute path to backend initialization script. + TUNEUP_BACKEND_INIT="${TUNEUP_BACKEND_DIR}/$(cli_getRepoName ${TUNEUP_BACKEND} -f)" + + # Verify absolute path to backend initialization script. When + # a file extension is provided, but no backend initialization + # script exists for it, continue with the next file extension + # in the list. + if [[ ! -f ${TUNEUP_BACKEND_INIT} ]];then + continue + fi + + # Define absolute path to directory where backend-specific + # configurations are retrived from. + TUNEUP_CONFIG_DIR="${TUNEUP_BACKEND_DIR}/Config" + + # Build list of files to process using action value as + # reference. + FILES=$(cli_getFilesList ${ACTIONVAL} --pattern="${FLAG_FILTER}\.${TUNEUP_EXTENSION}") + + # Verify list of files to process. Assuming no file is found, + # evaluate the next supported file extension. + if [[ $FILES == '' ]];then + continue + fi + + # Export backend-specific functionalities up to the + # execution environment. + cli_exportFunctions "${TUNEUP_BASEDIR}/$(cli_getRepoName \ + ${TUNEUP_BACKEND} -d)" "${TUNEUP_BACKEND}" + + # Execute backend-specific maintainance tasks. + for FILE in $FILES;do + cli_printMessage "$FILE" --as-tuningup-line + ${TUNEUP_BACKEND} + done + + # Unset backend-specific functionalities from execution + # environment. This is required to prevent end up with more + # than one backend-specifc function initialization, in those + # cases when different template files are rendered in just one + # execution of `centos-art.sh' script. + cli_unsetFunctions "${TUNEUP_BASEDIR}/$(cli_getRepoName \ + ${TUNEUP_BACKEND} -d)" "${TUNEUP_BACKEND}" + + done + +} diff --git a/Scripts/Bash/Functions/Tuneup/tuneup_getOptions.sh b/Scripts/Bash/Functions/Tuneup/tuneup_getOptions.sh new file mode 100755 index 0000000..38aaf9b --- /dev/null +++ b/Scripts/Bash/Functions/Tuneup/tuneup_getOptions.sh @@ -0,0 +1,92 @@ +#!/bin/bash +# +# tuneup_getOptions.sh -- This function interprets option parameters +# passed to `tuneup' functionality and calls actions accordingly. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function tuneup_getOptions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="filter:,quiet,answer-yes,dont-commit-changes" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + + case "$1" in + + --filter ) + FLAG_FILTER="$2" + shift 2 + ;; + + --quiet ) + FLAG_QUIET="true" + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + --answer-yes ) + FLAG_ANSWER="true" + shift 1 + ;; + + --dont-commit-changes ) + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + -- ) + # Remove the `--' argument from the list of arguments + # in order for processing non-option arguments + # correctly. At this point all option arguments have + # been processed already but the `--' argument still + # remains to mark ending of option arguments and + # begining of non-option arguments. The `--' argument + # needs to be removed here in order to avoid + # centos-art.sh script to process it as a path inside + # the repository, which obviously is not. + shift 1 + break + ;; + esac + done + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Verify non-option arguments passed to command-line. If there + # isn't any, redefine the ARGUMENTS variable to use the current + # location the functionality was called from. + if [[ $ARGUMENTS == '' ]];then + ARGUMENTS=${PWD} + fi + +} diff --git a/Scripts/Bash/Functions/cli.sh b/Scripts/Bash/Functions/cli.sh new file mode 100755 index 0000000..e9f1acb --- /dev/null +++ b/Scripts/Bash/Functions/cli.sh @@ -0,0 +1,113 @@ +#!/bin/bash +# +# cli.sh -- This function initiates centos-art command-line interface. +# Variables defined in this function are accesible by all other +# functions. The cli function is the first script executed by +# centos-art command-line onces invoked. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli { + + # Initialize global variables. + local CLI_FUNCNAME='' + local CLI_FUNCDIR='' + local CLI_FUNCDIRNAM='' + local CLI_FUNCSCRIPT='' + local ARGUMENTS='' + + # Initialize default value to filter flag. The filter flag + # (--filter) is used mainly to reduce the number of files to + # process. The value of this variable is interpreted as + # egrep-posix regular expression. By default, everything matches. + local FLAG_FILTER='.+' + + # Initialize default value to verbosity flag. The verbosity flag + # (--quiet) controls whether centos-art.sh script prints messages + # or not. By default, all messages are printed out. + local FLAG_QUIET='false' + + # Initialize default value to answer flag. The answer flag + # (--answer-yes) controls whether centos-art.sh script does or + # does not pass confirmation request points. By default, it + # doesn't. + local FLAG_ANSWER='false' + + # Initialize default value to don't commit changes flag. The don't + # commit changes flag (--dont-commit-changes) controls whether + # centos-art.sh script syncronizes changes between the central + # repository and the working copy. By default, it does. + local FLAG_DONT_COMMIT_CHANGES='false' + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Define function directory (CLI_FUNCDIR). The directory path where + # functionalities are stored inside the repository. + CLI_FUNCDIR=${CLI_BASEDIR}/Functions + + # Check function name. The function name is critical for + # centos-art.sh script to do something coherent. If it is not + # provided, execute the help functionality and end script + # execution. + if [[ "$1" == '' ]];then + exec ${CLI_BASEDIR}/centos-art.sh help + exit + fi + + # Define function name (CLI_FUNCNAME) variable from first command-line + # argument. As convenction we use the first argument to determine + # the exact name of functionality to call. + CLI_FUNCNAME=$(cli_getRepoName $1 -f) + + # Define function directory. + CLI_FUNCDIRNAM=$(cli_getRepoName $CLI_FUNCNAME -d) + + # Define function file name. + CLI_FUNCSCRIPT=${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}/${CLI_FUNCNAME}.sh + + # Check function script execution rights. + cli_checkFiles "${CLI_FUNCSCRIPT}" --execution + + # Remove the first argument passed to centos-art.sh command-line + # in order to build optional arguments inside functionalities. We + # start counting from second argument (inclusive) on. + shift 1 + + # Redefine ARGUMENTS using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Define default text editors used by centos-art.sh script. + if [[ ! "$EDITOR" =~ '/usr/bin/(vim|emacs|nano)' ]];then + EDITOR='/usr/bin/vim' + fi + + # Check text editor execution rights. + cli_checkFiles $EDITOR --execution + + # Go for function initialization. Keep the cli_exportFunctions + # function calling after all variables and arguments definitions. + cli_exportFunctions "${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}" + + # Execute function. + eval $CLI_FUNCNAME + +} diff --git a/Scripts/Bash/Functions/cli_checkFiles.sh b/Scripts/Bash/Functions/cli_checkFiles.sh new file mode 100755 index 0000000..56df0bb --- /dev/null +++ b/Scripts/Bash/Functions/cli_checkFiles.sh @@ -0,0 +1,157 @@ +#!/bin/bash +# +# cli_checkFiles.sh -- This function standardizes the way file +# conditional expressions are applied inside centos-art.sh script. +# Here is where we answer questions like: is the file a regular file +# or a directory? or, is it a symbolic link? or even, does it have +# execution rights, etc. If the verification fails somehow at any +# point, an error message is output and centos-art.sh script ends its +# execution. +# +# More than one file can be passed to this function, so we want to +# process them all as specified by the options. Since we are using +# getopt output it is possible to determine where options and +# non-option arguments are in the list of arguments (e.g., options +# are on the left side of ` -- ' and non-options on the rigth side of +# ` -- '). Non-options are the files we want to verify and options how +# we want to verify them. +# +# Another issue to consider, when more than one file is passed to this +# function, is that we cannot shift positional parameters as we +# frequently do whe just one argument is passsed, doing so would +# annulate the validation for the second and later files passed to the +# function. So, in order to provide verification to all files passed +# to the function, the verification loop must be set individual for +# each option in this function. +# +# Assuming no option be passed to the function, a general verification +# is performed to determine whether or not the file exists without +# considering the file type just its existence. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_checkFiles { + + # Define short options. + local ARGSS='d,r,h,n,x,w' + + # Define long options. + local ARGSL='directory,regular-file,symbolic-link,execution,versioned,working-copy' + + # Initialize arguments with an empty value and set it as local + # variable to this function scope. + local ARGUMENTS='' + + # Initialize file variable as local to avoid conflicts outside + # this function scope. In the file variable will set the file path + # we'r going to verify. + local FILE='' + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Define list of files we want to apply verifications to. + local FILES=$(echo $@ | sed -r 's!^.*--[[:space:]](.+)$!\1!') + + # Verify files in the list. It is required at least one. + if [[ $FILES =~ '--$' ]];then + cli_printMessage "You need to provide one file at least." --as-error-line + fi + + # Look for options passed through positional parameters. + while true; do + + case "$1" in + + -d|--directory ) + for FILE in $(echo $FILES);do + if [[ ! -d $FILE ]];then + cli_printMessage "`eval_gettext "The directory \\\"\\\$FILE\\\" does not exist."`" --as-error-line + fi + done + shift 1 + ;; + + -f|--regular-file ) + for FILE in $(echo $FILES);do + if [[ ! -f $FILE ]];then + cli_printMessage "`eval_gettext "The file \\\"\\\$FILE\\\" is not a regular file."`" --as-error-line + fi + done + shift 1 + ;; + + -h|--symbolic-link ) + for FILE in $(echo $FILES);do + if [[ ! -h $FILE ]];then + cli_printMessage "`eval_gettext "The file \\\"\\\$FILE\\\" is not a symbolic link."`" --as-error-line + fi + done + shift 1 + ;; + + -n|--versioned ) + for FILE in $(echo $FILES);do + if [[ $(cli_isVersioned $FILE) == 'false' ]];then + cli_printMessage "`eval_gettext "The path \\\"\\\$FILE\\\" is not versioned."`" --as-error-line + fi + done + shift 1 + ;; + + -x|--execution ) + for FILE in $(echo $FILES);do + if [[ ! -x $FILE ]];then + cli_printMessage "`eval_gettext "The file \\\"\\\$FILE\\\" is not executable."`" --as-error-line + fi + done + shift 1 + ;; + + -w|--working-copy ) + for FILE in $(echo $FILES);do + if [[ ! $FILE =~ "^${CLI_WRKCOPY}/.+$" ]];then + cli_printMessage "`eval_gettext "The path \\\"\\\$FILE\\\" does not exist inside the working copy."`" --as-error-line + fi + done + shift 1 + ;; + + -- ) + for FILE in $(echo $FILES);do + if [[ ! -a $FILE ]];then + cli_printMessage "`eval_gettext "The path \\\"\\\$FILE\\\" does not exist."`" --as-error-line + fi + done + shift 1 + break + ;; + + esac + done + +} diff --git a/Scripts/Bash/Functions/cli_checkPathComponent.sh b/Scripts/Bash/Functions/cli_checkPathComponent.sh new file mode 100755 index 0000000..182850a --- /dev/null +++ b/Scripts/Bash/Functions/cli_checkPathComponent.sh @@ -0,0 +1,111 @@ +#!/bin/bash +# +# cli_checkPathComponent.sh -- This function checks parts/components +# from repository paths. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_checkPathComponent { + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='release,architecture,motif' + + # Initialize arguments with an empty value and set it as local + # variable to this function scope. + local ARGUMENTS='' + + # Initialize file variable as local to avoid conflicts outside + # this function scope. In the file variable will set the file path + # we are going to verify. + local FILE='' + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Define list of locations we want to apply verifications to. + local FILES=$(echo $@ | sed -r 's!^.*--[[:space:]](.+)$!\1!') + + # Verify list of locations, it is required that one location be + # present in the list and also be a valid file. + if [[ $FILES == '--' ]];then + cli_printMessage "You need to provide one file at least." --as-error-line + fi + + # Look for options passed through positional parameters. + while true; do + + case "$1" in + + --release ) + for FILE in $(echo $FILES);do + if [[ ! $FILE =~ "^.+/$(cli_getPathComponent --release-pattern)/.*$" ]];then + cli_printMessage "`eval_gettext "The release \\\"\\\$FILE\\\" is not valid."`" --as-error-line + fi + done + shift 2 + break + ;; + + --architecture ) + for FILE in $(echo $FILES);do + if [[ ! $FILE =~ $(cli_getPathComponent --architecture-pattern) ]];then + cli_printMessage "`eval_gettext "The architecture \\\"\\\$FILE\\\" is not valid."`" --as-error-line + fi + done + shift 2 + break + ;; + + --motif ) + for FILE in $(echo $FILES);do + if [[ ! $FILE =~ $(cli_getPathComponent --motif-pattern) ]];then + cli_printMessage "`eval_gettext "The theme \\\"\\\$FILE\\\" is not valid."`" --as-error-line + fi + done + shift 2 + break + ;; + + -- ) + for FILE in $(echo $FILES);do + if [[ $FILE == '' ]] \ + || [[ $FILE =~ '(\.\.(/)?)' ]] \ + || [[ ! $FILE =~ '^[A-Za-z0-9\.:/_-]+$' ]]; then + cli_printMessage "`eval_gettext "The value \\\"\\\$FILE\\\" is not valid."`" --as-error-line + fi + done + shift 2 + break + ;; + + esac + done + +} diff --git a/Scripts/Bash/Functions/cli_checkRepoDirSource.sh b/Scripts/Bash/Functions/cli_checkRepoDirSource.sh new file mode 100755 index 0000000..7090848 --- /dev/null +++ b/Scripts/Bash/Functions/cli_checkRepoDirSource.sh @@ -0,0 +1,102 @@ +#!/bin/bash +# +# cli_checkRepoDirSource.sh -- This function provides input validation +# to repository entries considered as source locations. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_checkRepoDirSource { + + + # Define location in order to make this function reusable not just + # for action value variable but whatever value passed as first + # positional argument. + local LOCATION=$1 + + # Verify location. Assuming no location is passed as first + # positional parameter to this function, print an error message + # and stop script execution. + if [[ "$LOCATION" == '' ]];then + cli_printMessage "`gettext "The first positional parameter is required."`" --as-error-line + fi + + # Check action value to be sure strange characters are kept far + # away from path provided. + cli_checkPathComponent $LOCATION + + # Redefine source value to build repository absolute path from + # repository top level on. As we are removing + # /home/centos/artwork/ from all centos-art.sh output (in order to + # save horizontal output space), we need to be sure that all + # strings begining with trunk/..., branches/..., and tags/... use + # the correct absolute path. That is, you can refer trunk's + # entries using both /home/centos/artwork/trunk/... or just + # trunk/..., the /home/centos/artwork/ part is automatically added + # here. + if [[ $LOCATION =~ '^(trunk|branches|tags)' ]];then + LOCATION=${CLI_WRKCOPY}/$LOCATION + fi + + # Re-define source value to build repository absolute path from + # repository relative paths. This let us to pass repository + # relative paths as source value. Passing relative paths as + # source value may save us some typing; specially if we are stood + # a few levels up from the location we want to refer to as source + # value. There is no need to pass the absolute path to it, just + # refere it relatively. + if [[ -d ${LOCATION} ]];then + + # Add directory to the top of the directory stack. + pushd "$LOCATION" > /dev/null + + # Check directory existence inside the repository. + if [[ $(pwd) =~ "^${CLI_WRKCOPY}" ]];then + # Re-define source value using absolute path. + LOCATION=$(pwd) + else + cli_printMessage "`eval_gettext "The location \\\"\\\$LOCATION\\\" is not valid."`" --as-error-line + fi + + # Remove directory from the directory stack. + popd > /dev/null + + elif [[ -f ${LOCATION} ]];then + + # Add directory to the top of the directory stack. + pushd "$(dirname "$LOCATION")" > /dev/null + + # Check directory existence inside the repository. + if [[ $(pwd) =~ "^${CLI_WRKCOPY}" ]];then + # Re-define source value using absolute path. + LOCATION=$(pwd)/$(basename "$LOCATION") + else + cli_printMessage "`eval_gettext "The location \\\"\\\$LOCATION\\\" is not valid."`" --as-error-line + fi + + # Remove directory from the directory stack. + popd > /dev/null + + fi + + # Output sanitated location. + echo $LOCATION + +} diff --git a/Scripts/Bash/Functions/cli_checkRepoDirTarget.sh b/Scripts/Bash/Functions/cli_checkRepoDirTarget.sh new file mode 100755 index 0000000..b688c12 --- /dev/null +++ b/Scripts/Bash/Functions/cli_checkRepoDirTarget.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# cli_checkRepoDirTarget.sh -- This function provides input validation +# to repository entries considered as target location. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_checkRepoDirTarget { + + local LOCATION="$1" + + # Redefine target value to build repository absolute path from + # repository top level on. As we are removing + # /home/centos/artwork/ from all centos-art.sh output (in order to + # save horizontal output space), we need to be sure that all + # strings begining with trunk/..., branches/..., and tags/... use + # the correct absolute path. That is, you can refer trunk's + # entries using both /home/centos/artwork/trunk/... or just + # trunk/..., the /home/centos/artwork/ part is automatically added + # here. + if [[ $LOCATION =~ '^(trunk|branches|tags)/.+$' ]];then + LOCATION=${CLI_WRKCOPY}/$LOCATION + fi + + # Print target location. + echo $LOCATION + +} diff --git a/Scripts/Bash/Functions/cli_commitRepoChanges.sh b/Scripts/Bash/Functions/cli_commitRepoChanges.sh new file mode 100755 index 0000000..e3a7dc9 --- /dev/null +++ b/Scripts/Bash/Functions/cli_commitRepoChanges.sh @@ -0,0 +1,170 @@ +#!/bin/bash +# +# cli_commitRepoChanges.sh -- This function realizes a subversion +# commit command agains the workgin copy in order to send local +# changes up to central repository. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_commitRepoChanges { + + # Verify `--dont-commit-changes' option. + if [[ $FLAG_DONT_COMMIT_CHANGES == 'true' ]];then + return + fi + + local -a FILES + local -a INFO + local -a FILESNUM + local COUNT=0 + local STATUSOUT='' + local PREDICATE='' + local CHNGTOTAL=0 + local LOCATIONS='' + local LOCATION='' + + # Define source location the subversion status action will take + # place on. If arguments are provided use them as srouce location. + # Otherwise use action value as default source location. + if [[ "$@" != '' ]];then + LOCATIONS="$@" + else + LOCATIONS="$ACTIONVAL" + fi + + # Print action message. + cli_printMessage "`gettext "Checking changes in the working copy"`" --as-banner-line + + # Build list of files that have received changes in its versioned + # status. Be sure to keep output files off from this list. + # Remember, output files are not versioned inside the working + # copy, so they are not considered for evaluation here. But take + # care, sometimes output files are in the same format of source + # files, so we need to differentiate them using their locations. + for LOCATION in $LOCATIONS;do + + # Don't process location outside of version control. + if [[ $(cli_isVersioned $LOCATION) == 'false' ]];then + continue + fi + + # Process location based on its path information. + if [[ $LOCATION =~ '(trunk/Manuals/Tcar-fs|branches/Manuals/Texinfo)' ]];then + STATUSOUT="$(svn status ${LOCATION} | egrep -v '(pdf|txt|xhtml|xml|docbook|bz2)$')\n$STATUSOUT" + elif [[ $LOCATION =~ 'trunk/Manuals' ]];then + STATUSOUT="$(svn status ${LOCATION} | egrep -v '(pdf|txt|xhtml)$')\n$STATUSOUT" + elif [[ $LOCATION =~ 'trunk/Identity' ]];then + STATUSOUT="$(svn status ${LOCATION} | egrep -v '(pdf|png|jpg|rc|xpm|xbm|tif|ppm|pnm|gz|lss|log)$')\n$STATUSOUT" + else + STATUSOUT="$(svn status ${LOCATION})\n$STATUSOUT" + fi + + done + + # Sanitate status output. Expand new lines, remove leading spaces + # and empty lines. + STATUSOUT=$(echo -e "$STATUSOUT" | sed -r 's!^[[:space:]]*!!' | egrep -v '^[[:space:]]*$') + + # Define path fo files considered recent modifications from + # working copy up to central repository. + FILES[0]=$(echo "$STATUSOUT" | egrep "^M.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[1]=$(echo "$STATUSOUT" | egrep "^\?.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[2]=$(echo "$STATUSOUT" | egrep "^D.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[3]=$(echo "$STATUSOUT" | egrep "^A.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + + # Define description of files considered recent modifications from + # working copy up to central repository. + INFO[0]="`gettext "Modified"`" + INFO[1]="`gettext "Unversioned"`" + INFO[2]="`gettext "Deleted"`" + INFO[3]="`gettext "Added"`" + + while [[ $COUNT -ne ${#FILES[*]} ]];do + + # Define total number of files. Avoid counting empty line. + if [[ "${FILES[$COUNT]}" == '' ]];then + FILESNUM[$COUNT]=0 + else + FILESNUM[$COUNT]=$(echo "${FILES[$COUNT]}" | wc -l) + fi + + # Calculate total amount of changes. + CHNGTOTAL=$(($CHNGTOTAL + ${FILESNUM[$COUNT]})) + + # Build report predicate. Use report predicate to show any + # information specific to the number of files found. For + # example, you can use this section to show warning messages, + # notes, and so on. By default we use the word `file' or + # `files' at ngettext's consideration followed by change + # direction. + PREDICATE[$COUNT]=`ngettext "file in the working copy" \ + "files in the working copy" $((${FILESNUM[$COUNT]} + 1))` + + # Output report line. + cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}" + + # Increase counter. + COUNT=$(($COUNT + 1)) + + done + + # Check total amount of changes and, if any, check differences and + # commit them up to central repository. + if [[ $CHNGTOTAL -gt 0 ]];then + + # Outout separator line. + cli_printMessage '-' --as-separator-line + + # In the very specific case unversioned files, we need to add + # them to the repository first, in order to make them + # available for subversion commands (e.g., `copy') Otherwise, + # if no unversioned file is found, go ahead with change + # differences and committing. Notice that if there is mix of + # changes (e.g., aditions and modifications), addition take + # preference and no other change is considered. In order + # for other changes to be considered, be sure no adition is + # present, or that they have already happened. + if [[ ${FILESNUM[1]} -gt 0 ]];then + + cli_printMessage "`ngettext "The following file is unversioned" \ + "The following files are unversioned" ${FILESNUM[1]}`:" + for FILE in ${FILES[1]};do + cli_printMessage "$FILE" --as-response-line + done + cli_printMessage "`ngettext "Do you want to add it now?" \ + "Do you want to add them now?" ${FILESNUM[1]}`" --as-yesornorequest-line + svn add ${FILES[1]} --quiet + + else + + # Verify changes on locations. + cli_printMessage "`gettext "Do you want to see changes now?"`" --as-yesornorequest-line + svn diff $LOCATIONS | less + + # Commit changes on locations. + cli_printMessage "`gettext "Do you want to commit changes now?"`" --as-yesornorequest-line + svn commit $LOCATIONS + + fi + + fi + +} diff --git a/Scripts/Bash/Functions/cli_expandTMarkers.sh b/Scripts/Bash/Functions/cli_expandTMarkers.sh new file mode 100755 index 0000000..1bf6c1d --- /dev/null +++ b/Scripts/Bash/Functions/cli_expandTMarkers.sh @@ -0,0 +1,175 @@ +#!/bin/bash +# +# cli_expandTMarkers.sh -- This function standardizes +# replacements for common translation markers. Raplacements are +# applied to temporal instances used to produce the final file. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_expandTMarkers { + + # Initialize variables. + local -a SRC + local -a DST + local COUNT=0 + local COUNTSRC=0 + local COUNTDST=0 + local LOCATION='' + + # Define source location on which sed replacements take place. + LOCATION="$1" + + # Verify file source location. + cli_checkFiles $LOCATION + + # Define copyright translation markers. + SRC[((++${#SRC[*]}))]='=COPYRIGHT_YEAR_LAST=' + DST[((++${#DST[*]}))]="$(cli_printCopyrightInfo --copyright-year)" + SRC[((++${#SRC[*]}))]='=COPYRIGHT_YEAR=' + DST[((++${#DST[*]}))]="$(cli_printCopyrightInfo --copyright-year)" + SRC[((++${#SRC[*]}))]='=COPYRIGHT_YEAR_LIST=' + DST[((++${#DST[*]}))]="$(cli_printCopyrightInfo --copyright-year-list)" + SRC[((++${#SRC[*]}))]='=COPYRIGHT_HOLDER=' + DST[((++${#DST[*]}))]="$(cli_printCopyrightInfo --copyright-holder)" + SRC[((++${#SRC[*]}))]='=COPYRIGHT_HOLDER_PREDICATE=' + DST[((++${#DST[*]}))]="$(cli_printCopyrightInfo --copyright-holder-predicate)" + + # Define license translation markers. + SRC[((++${#SRC[*]}))]='=LICENSE=' + DST[((++${#DST[*]}))]="$(cli_printCopyrightInfo --license)" + SRC[((++${#SRC[*]}))]='=LICENSE_URL=' + DST[((++${#DST[*]}))]="$(cli_printCopyrightInfo --license-url)" + + # Define theme translation markers. + SRC[((++${#SRC[*]}))]='=THEME=' + DST[((++${#DST[*]}))]="$(cli_getPathComponent $OUTPUT --motif)" + SRC[((++${#SRC[*]}))]='=THEMENAME=' + DST[((++${#DST[*]}))]="$(cli_getPathComponent $OUTPUT --motif-name)" + SRC[((++${#SRC[*]}))]='=THEMERELEASE=' + DST[((++${#DST[*]}))]="$(cli_getPathComponent $OUTPUT --motif-release)" + + # Define release-specific translation markers. + SRC[((++${#SRC[*]}))]='=RELEASE=' + DST[((++${#DST[*]}))]="$FLAG_RELEASEVER" + SRC[((++${#SRC[*]}))]='=MAJOR_RELEASE=' + DST[((++${#DST[*]}))]="$(echo $FLAG_RELEASEVER | cut -d'.' -f1)" + SRC[((++${#SRC[*]}))]='=MINOR_RELEASE=' + DST[((++${#DST[*]}))]="$(echo $FLAG_RELEASEVER | cut -d'.' -f2)" + + # Define architectures translation markers. + SRC[((++${#SRC[*]}))]='=ARCH=' + DST[((++${#DST[*]}))]="$(cli_getPathComponent $FLAG_BASEARCH --architecture)" + + # Define url translation markers. + SRC[((++${#SRC[*]}))]='=URL=' + DST[((++${#DST[*]}))]=$(cli_printUrl '--home' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_WIKI=' + DST[((++${#DST[*]}))]=$(cli_printUrl '--wiki' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_LISTS=' + DST[((++${#DST[*]}))]=$(cli_printUrl '--lists' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_FORUMS=' + DST[((++${#DST[*]}))]=$(cli_printUrl '--forums' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_MIRRORS=' + DST[((++${#DST[*]}))]=$(cli_printUrl '--mirrors' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_DOCS=' + DST[((++${#DST[*]}))]=$(cli_printUrl '--docs' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_IRC=' + DST[((++${#DST[*]}))]=$(cli_printUrl '--irc') + + # Define emails translation markers. + SRC[((++${#SRC[*]}))]='=MAIL_DOCS=' + DST[((++${#DST[*]}))]="centos-docs@centos.org" + SRC[((++${#SRC[*]}))]='=MAIL_L10N=' + DST[((++${#DST[*]}))]="centos-l10n@centos.org" + + # Define locale translation markers. + SRC[((++${#SRC[*]}))]='=LOCALE_LL=' + DST[((++${#DST[*]}))]="$(cli_getCurrentLocale '--langcode-only')" + SRC[((++${#SRC[*]}))]='=LOCALE=' + DST[((++${#DST[*]}))]="$(cli_getCurrentLocale)" + + # Define domain translation markers for domains. + SRC[((++${#SRC[*]}))]='=DOMAIN_LL=' + if [[ ! $(cli_getCurrentLocale) =~ '^en' ]];then + DST[((++${#DST[*]}))]="$(cli_getCurrentLocale '--langcode-only')." + else + DST[((++${#DST[*]}))]="" + fi + + # Define repository translation markers. + SRC[((++${#SRC[*]}))]='=REPO_TLDIR=' + DST[((++${#DST[*]}))]="$(cli_getRepoTLDir)" + SRC[((++${#SRC[*]}))]='=REPO_HOME=' + DST[((++${#DST[*]}))]="${CLI_WRKCOPY}" + + # Do replacement of nested translation markers. + while [[ $COUNTDST -lt ${#DST[@]} ]];do + + # Verify existence of translation markers. If there is no + # translation marker on replacement, continue with the next + # one in the list. + if [[ ! ${DST[$COUNTDST]} =~ '=[A-Z_]+=' ]];then + # Increment destination counter. + COUNTDST=$(($COUNTDST + 1)) + # The current replacement value doesn't have translation + # marker inside, so skip it and evaluate the next + # replacement value in the list. + continue + fi + + while [[ $COUNTSRC -lt ${#SRC[*]} ]];do + + # Update replacements. + DST[$COUNTDST]=$(echo ${DST[$COUNTDST]} \ + | sed -r "s!${SRC[$COUNTSRC]}!${DST[$COUNTSRC]}!g") + + # Increment source counter. + COUNTSRC=$(($COUNTSRC + 1)) + + done + + # Reset source counter + COUNTSRC=0 + + # Increment destination counter. + COUNTDST=$(($COUNTDST + 1)) + + done + + # Apply replacements for translation markers. + while [[ ${COUNT} -lt ${#SRC[*]} ]];do + + # Use sed to replace translation markers inside the design + # model instance. + sed -r -i "s!${SRC[$COUNT]}!${DST[$COUNT]}!g" ${LOCATION} + + # Increment counter. + COUNT=$(($COUNT + 1)) + + done + + # Unset specific translation markers and specific replacement + # variables in order to clean them up. Otherwise, undesired values + # may ramain from one file to another. + unset SRC + unset DST + +} diff --git a/Scripts/Bash/Functions/cli_exportFunctions.sh b/Scripts/Bash/Functions/cli_exportFunctions.sh new file mode 100755 index 0000000..2a85602 --- /dev/null +++ b/Scripts/Bash/Functions/cli_exportFunctions.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# cli_exportFunctions.sh -- This function exports funtionalities to +# `centos-art.sh' script execution evironment. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_exportFunctions { + + # Define source location where function files are placed in. + local LOCATION=$1 + + # Define suffix used to retrive function files. + local SUFFIX=$2 + + # Verify suffix value used to retrive function files. Assuming no + # suffix value is passed as second argument to this function, use + # the function name value (CLI_FUNCNAME) as default value. + if [[ $SUFFIX == '' ]];then + SUFFIX=$CLI_FUNCNAME + fi + + # Define pattern used to retrive function names from function + # files. + local PATTERN="^function[[:space:]]+${SUFFIX}[[:alnum:]_]*[[:space:]]+{$" + + # Define list of files. + local FUNCFILE='' + local FUNCFILES=$(cli_getFilesList ${LOCATION} --pattern="${SUFFIX}.*\.sh" --maxdepth="1") + + # Verify list of files. If no function file exists for the + # location specified stop the script execution. Otherwise the + # script will surely try to execute a function that haven't been + # exported yet and report an error about it. + if [[ $FUNCFILES == '' ]];then + cli_printMessage "`gettext "No function file was found for this action."`" --as-error-line + fi + + # Process list of files. + for FUNCFILE in $FUNCFILES;do + + # Verify file execution rights. + cli_checkFiles $FUNCFILE --execution + + # Initialize file. + . $FUNCFILE + + # Export function names inside the file to current shell + # script environment. + export -f $(egrep "${PATTERN}" ${FUNCFILE} | gawk '{ print $2 }') + + done + +} diff --git a/Scripts/Bash/Functions/cli_getConfigLines.sh b/Scripts/Bash/Functions/cli_getConfigLines.sh new file mode 100755 index 0000000..248d4cf --- /dev/null +++ b/Scripts/Bash/Functions/cli_getConfigLines.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# cli_getConfigLines.sh -- This function retrives configuration lines +# form configuration files. As arguments, the configuration file +# absolute path, the configuration section name, and the configuration +# variable name must be provided. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getConfigLines { + + # Initialize absolute path to configuration file. + local CONFIG_ABSPATH="$1" + + # Verify absolute path to configuration file. + cli_checkFiles ${CONFIG_ABSPATH} + + # Initialize configuration section name where the variable value + # we want to to retrive is set in. + local CONFIG_SECTION="$2" + + # Initialize variable name we want to retrive value from. + local CONFIG_VARNAME="$3" + + # Verify configuration variable name. When no variable name is + # provided print all configuration lines that can be considered + # as well-formed paths. Be sure configuration variable name starts + # just at the begining of the line. + if [[ ! $CONFIG_VARNAME =~ '^[[:alnum:]_./-]+$' ]];then + CONFIG_VARNAME='[[:alnum:]_./-]+=' + fi + + # Retrive configuration lines from configuration file. + local CONFIG_LINES=$(cat ${CONFIG_ABSPATH} \ + | egrep -v '^#' \ + | egrep -v '^[[:space:]]*$' \ + | sed -r 's![[:space:]]*!!g' \ + | sed -r -n "/^\[${CONFIG_SECTION}\]$/,/^\[/p" \ + | egrep -v '^\[' | sort | uniq \ + | egrep "^${CONFIG_VARNAME}") + + # Output value related to variable name. + echo "$CONFIG_LINES" + +} diff --git a/Scripts/Bash/Functions/cli_getConfigValue.sh b/Scripts/Bash/Functions/cli_getConfigValue.sh new file mode 100755 index 0000000..4b54ec6 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getConfigValue.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# cli_getConfigValue.sh -- This function retrives configuration values +# from configuration files. As arguments, the configuration file +# absolute path, the configuration section name, and the configuration +# variable name must be provided. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getConfigValue { + + # Initialize absolute path to configuration file. + local CONFIG_ABSPATH="$1" + + # Initialize configuration section name where the variable value + # we want to to retrive is set in. + local CONFIG_SECTION="$2" + + # Initialize variable name we want to retrive value from. + local CONFIG_VARNAME="$3" + + # Retrive configuration lines from configuration file. + local CONFIG_LINES=$(cli_getConfigLines \ + "$CONFIG_ABSPATH" "$CONFIG_SECTION" "$CONFIG_VARNAME") + + # Parse configuration lines to retrive the values of variable + # names. + local CONFIG_VARVALUE=$(echo $CONFIG_LINES \ + | gawk 'BEGIN { FS="=" } { print $2 }' \ + | sed -r 's/^"(.*)"$/\1/') + + # Output values related to variable name. + echo "$CONFIG_VARVALUE" + +} diff --git a/Scripts/Bash/Functions/cli_getCountryCodes.sh b/Scripts/Bash/Functions/cli_getCountryCodes.sh new file mode 100755 index 0000000..a521486 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getCountryCodes.sh @@ -0,0 +1,276 @@ +#!/bin/bash +# +# cli_getCountryCodes.sh -- This function outputs a list with country +# codes as defined in ISO3166 standard. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getCountryCodes { + + local FILTER="$(echo $1 | cut -d_ -f2)" + + COUNTRYCODES='AD + AE + AF + AG + AI + AL + AM + AN + AO + AQ + AR + AS + AT + AU + AW + AZ + BA + BB + BD + BE + BF + BG + BH + BI + BJ + BM + BN + BO + BR + BS + BT + BV + BW + BY + BZ + CA + CC + CD + CF + CG + CH + CI + CK + CL + CM + CN + CO + CR + CS + CU + CV + CX + CY + CZ + DE + DJ + DK + DM + DO + DZ + EC + EE + EG + EH + ER + ES + ET + FI + FJ + FK + FM + FO + FR + GA + GB + GD + GE + GF + GH + GI + GL + GM + GN + GP + GQ + GR + GS + GT + GU + GW + GY + HK + HM + HN + HR + HT + HU + ID + IE + IL + IN + IO + IQ + IR + IS + IT + JM + JO + JP + KE + KG + KH + KI + KM + KN + KP + KR + KW + KY + KZ + LA + LB + LC + LI + LK + LR + LS + LT + LU + LV + LY + MA + MC + MD + MG + MH + MK + ML + MM + MN + MO + MP + MQ + MR + MS + MT + MU + MV + MW + MX + MY + MZ + NA + NC + NE + NF + NG + NI + NL + NO + NP + NR + NU + NZ + OM + PA + PE + PF + PG + PH + PK + PL + PM + PN + PR + PS + PT + PW + PY + QA + RE + RO + RU + RW + SA + SB + SC + SD + SE + SG + SH + SI + SJ + SK + SL + SM + SN + SO + SR + ST + SV + SY + SZ + TC + TD + TF + TG + TH + TJ + TK + TL + TM + TN + TO + TR + TT + TV + TW + TZ + UA + UG + UM + US + UY + UZ + VA + VC + VE + VG + VI + VN + VU + WF + WS + YE + YT + ZA + ZM + ZW' + + if [[ $FILTER != '' ]];then + echo $COUNTRYCODES | egrep "$FILTER" + else + echo "$COUNTRYCODES" + fi + +} diff --git a/Scripts/Bash/Functions/cli_getCountryName.sh b/Scripts/Bash/Functions/cli_getCountryName.sh new file mode 100755 index 0000000..0db8776 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getCountryName.sh @@ -0,0 +1,758 @@ +#!/bin/bash +# +# cli_getCountryName.sh -- This function reads one language locale +# code in the format LL_CC and outputs the name of its related +# country. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getCountryName { + + local LOCALECODE="$(echo $1 | cut -d_ -f2)" + local COUNTRYNAME="" + + case $LOCALECODE in + + 'AD' ) + COUNTRYNAME="`gettext "Andorra"`" + ;; + 'AE' ) + COUNTRYNAME="`gettext "United Arab Emirates"`" + ;; + 'AF' ) + COUNTRYNAME="`gettext "Afghanistan"`" + ;; + 'AG' ) + COUNTRYNAME="`gettext "Antigua and Barbuda"`" + ;; + 'AI' ) + COUNTRYNAME="`gettext "Anguilla"`" + ;; + 'AL' ) + COUNTRYNAME="`gettext "Albania"`" + ;; + 'AM' ) + COUNTRYNAME="`gettext "Armenia"`" + ;; + 'AN' ) + COUNTRYNAME="`gettext "Netherlands Antilles"`" + ;; + 'AO' ) + COUNTRYNAME="`gettext "Angola"`" + ;; + 'AQ' ) + COUNTRYNAME="`gettext "Antarctica"`" + ;; + 'AR' ) + COUNTRYNAME="`gettext "Argentina"`" + ;; + 'AS' ) + COUNTRYNAME="`gettext "Samoa (American)"`" + ;; + 'AT' ) + COUNTRYNAME="`gettext "Austria"`" + ;; + 'AU' ) + COUNTRYNAME="`gettext "Australia"`" + ;; + 'AW' ) + COUNTRYNAME="`gettext "Aruba"`" + ;; + 'AZ' ) + COUNTRYNAME="`gettext "Azerbaijan"`" + ;; + 'BA' ) + COUNTRYNAME="`gettext "Bosnia and Herzegovina"`" + ;; + 'BB' ) + COUNTRYNAME="`gettext "Barbados"`" + ;; + 'BD' ) + COUNTRYNAME="`gettext "Bangladesh"`" + ;; + 'BE' ) + COUNTRYNAME="`gettext "Belgium"`" + ;; + 'BF' ) + COUNTRYNAME="`gettext "Burkina Faso"`" + ;; + 'BG' ) + COUNTRYNAME="`gettext "Bulgaria"`" + ;; + 'BH' ) + COUNTRYNAME="`gettext "Bahrain"`" + ;; + 'BI' ) + COUNTRYNAME="`gettext "Burundi"`" + ;; + 'BJ' ) + COUNTRYNAME="`gettext "Benin"`" + ;; + 'BM' ) + COUNTRYNAME="`gettext "Bermuda"`" + ;; + 'BN' ) + COUNTRYNAME="`gettext "Brunei"`" + ;; + 'BO' ) + COUNTRYNAME="`gettext "Bolivia"`" + ;; + 'BR' ) + COUNTRYNAME="`gettext "Brazil"`" + ;; + 'BS' ) + COUNTRYNAME="`gettext "Bahamas"`" + ;; + 'BT' ) + COUNTRYNAME="`gettext "Bhutan"`" + ;; + 'BV' ) + COUNTRYNAME="`gettext "Bouvet Island"`" + ;; + 'BW' ) + COUNTRYNAME="`gettext "Botswana"`" + ;; + 'BY' ) + COUNTRYNAME="`gettext "Belarus"`" + ;; + 'BZ' ) + COUNTRYNAME="`gettext "Belize"`" + ;; + 'CA' ) + COUNTRYNAME="`gettext "Canada"`" + ;; + 'CC' ) + COUNTRYNAME="`gettext "Cocos (Keeling) Islands"`" + ;; + 'CD' ) + COUNTRYNAME="`gettext "Congo (Dem. Rep.)"`" + ;; + 'CF' ) + COUNTRYNAME="`gettext "Central African Rep."`" + ;; + 'CG' ) + COUNTRYNAME="`gettext "Congo (Rep.)"`" + ;; + 'CH' ) + COUNTRYNAME="`gettext "Switzerland"`" + ;; + 'CI' ) + COUNTRYNAME="`gettext "Co^te d'Ivoire"`" + ;; + 'CK' ) + COUNTRYNAME="`gettext "Cook Islands"`" + ;; + 'CL' ) + COUNTRYNAME="`gettext "Chile"`" + ;; + 'CM' ) + COUNTRYNAME="`gettext "Cameroon"`" + ;; + 'CN' ) + COUNTRYNAME="`gettext "China"`" + ;; + 'CO' ) + COUNTRYNAME="`gettext "Colombia"`" + ;; + 'CR' ) + COUNTRYNAME="`gettext "Costa Rica"`" + ;; + 'CS' ) + COUNTRYNAME="`gettext "Serbia and Montenegro"`" + ;; + 'CU' ) + COUNTRYNAME="`gettext "Cuba"`" + ;; + 'CV' ) + COUNTRYNAME="`gettext "Cape Verde"`" + ;; + 'CX' ) + COUNTRYNAME="`gettext "Christmas Island"`" + ;; + 'CY' ) + COUNTRYNAME="`gettext "Cyprus"`" + ;; + 'CZ' ) + COUNTRYNAME="`gettext "Czech Republic"`" + ;; + 'DE' ) + COUNTRYNAME="`gettext "Germany"`" + ;; + 'DJ' ) + COUNTRYNAME="`gettext "Djibouti"`" + ;; + 'DK' ) + COUNTRYNAME="`gettext "Denmark"`" + ;; + 'DM' ) + COUNTRYNAME="`gettext "Dominica"`" + ;; + 'DO' ) + COUNTRYNAME="`gettext "Dominican Republic"`" + ;; + 'DZ' ) + COUNTRYNAME="`gettext "Algeria"`" + ;; + 'EC' ) + COUNTRYNAME="`gettext "Ecuador"`" + ;; + 'EE' ) + COUNTRYNAME="`gettext "Estonia"`" + ;; + 'EG' ) + COUNTRYNAME="`gettext "Egypt"`" + ;; + 'EH' ) + COUNTRYNAME="`gettext "Western Sahara"`" + ;; + 'ER' ) + COUNTRYNAME="`gettext "Eritrea"`" + ;; + 'ES' ) + COUNTRYNAME="`gettext "Spain"`" + ;; + 'ET' ) + COUNTRYNAME="`gettext "Ethiopia"`" + ;; + 'FI' ) + COUNTRYNAME="`gettext "Finland"`" + ;; + 'FJ' ) + COUNTRYNAME="`gettext "Fiji"`" + ;; + 'FK' ) + COUNTRYNAME="`gettext "Falkland Islands"`" + ;; + 'FM' ) + COUNTRYNAME="`gettext "Micronesia"`" + ;; + 'FO' ) + COUNTRYNAME="`gettext "Faeroe Islands"`" + ;; + 'FR' ) + COUNTRYNAME="`gettext "France"`" + ;; + 'GA' ) + COUNTRYNAME="`gettext "Gabon"`" + ;; + 'GB' ) + COUNTRYNAME="`gettext "Britain (UK)"`" + ;; + 'GD' ) + COUNTRYNAME="`gettext "Grenada"`" + ;; + 'GE' ) + COUNTRYNAME="`gettext "Georgia"`" + ;; + 'GF' ) + COUNTRYNAME="`gettext "French Guiana"`" + ;; + 'GH' ) + COUNTRYNAME="`gettext "Ghana"`" + ;; + 'GI' ) + COUNTRYNAME="`gettext "Gibraltar"`" + ;; + 'GL' ) + COUNTRYNAME="`gettext "Greenland"`" + ;; + 'GM' ) + COUNTRYNAME="`gettext "Gambia"`" + ;; + 'GN' ) + COUNTRYNAME="`gettext "Guinea"`" + ;; + 'GP' ) + COUNTRYNAME="`gettext "Guadeloupe"`" + ;; + 'GQ' ) + COUNTRYNAME="`gettext "Equatorial Guinea"`" + ;; + 'GR' ) + COUNTRYNAME="`gettext "Greece"`" + ;; + 'GS' ) + COUNTRYNAME="`gettext "South Georgia and the South Sandwich Islands"`" + ;; + 'GT' ) + COUNTRYNAME="`gettext "Guatemala"`" + ;; + 'GU' ) + COUNTRYNAME="`gettext "Guam"`" + ;; + 'GW' ) + COUNTRYNAME="`gettext "Guinea-Bissau"`" + ;; + 'GY' ) + COUNTRYNAME="`gettext "Guyana"`" + ;; + 'HK' ) + COUNTRYNAME="`gettext "Hong Kong"`" + ;; + 'HM' ) + COUNTRYNAME="`gettext "Heard Island and McDonald Islands"`" + ;; + 'HN' ) + COUNTRYNAME="`gettext "Honduras"`" + ;; + 'HR' ) + COUNTRYNAME="`gettext "Croatia"`" + ;; + 'HT' ) + COUNTRYNAME="`gettext "Haiti"`" + ;; + 'HU' ) + COUNTRYNAME="`gettext "Hungary"`" + ;; + 'ID' ) + COUNTRYNAME="`gettext "Indonesia"`" + ;; + 'IE' ) + COUNTRYNAME="`gettext "Ireland"`" + ;; + 'IL' ) + COUNTRYNAME="`gettext "Israel"`" + ;; + 'IN' ) + COUNTRYNAME="`gettext "India"`" + ;; + 'IO' ) + COUNTRYNAME="`gettext "British Indian Ocean Territory"`" + ;; + 'IQ' ) + COUNTRYNAME="`gettext "Iraq"`" + ;; + 'IR' ) + COUNTRYNAME="`gettext "Iran"`" + ;; + 'IS' ) + COUNTRYNAME="`gettext "Iceland"`" + ;; + 'IT' ) + COUNTRYNAME="`gettext "Italy"`" + ;; + 'JM' ) + COUNTRYNAME="`gettext "Jamaica"`" + ;; + 'JO' ) + COUNTRYNAME="`gettext "Jordan"`" + ;; + 'JP' ) + COUNTRYNAME="`gettext "Japan"`" + ;; + 'KE' ) + COUNTRYNAME="`gettext "Kenya"`" + ;; + 'KG' ) + COUNTRYNAME="`gettext "Kyrgyzstan"`" + ;; + 'KH' ) + COUNTRYNAME="`gettext "Cambodia"`" + ;; + 'KI' ) + COUNTRYNAME="`gettext "Kiribati"`" + ;; + 'KM' ) + COUNTRYNAME="`gettext "Comoros"`" + ;; + 'KN' ) + COUNTRYNAME="`gettext "St Kitts and Nevis"`" + ;; + 'KP' ) + COUNTRYNAME="`gettext "Korea (North)"`" + ;; + 'KR' ) + COUNTRYNAME="`gettext "Korea (South)"`" + ;; + 'KW' ) + COUNTRYNAME="`gettext "Kuwait"`" + ;; + 'KY' ) + COUNTRYNAME="`gettext "Cayman Islands"`" + ;; + 'KZ' ) + COUNTRYNAME="`gettext "Kazakhstan"`" + ;; + 'LA' ) + COUNTRYNAME="`gettext "Laos"`" + ;; + 'LB' ) + COUNTRYNAME="`gettext "Lebanon"`" + ;; + 'LC' ) + COUNTRYNAME="`gettext "St Lucia"`" + ;; + 'LI' ) + COUNTRYNAME="`gettext "Liechtenstein"`" + ;; + 'LK' ) + COUNTRYNAME="`gettext "Sri Lanka"`" + ;; + 'LR' ) + COUNTRYNAME="`gettext "Liberia"`" + ;; + 'LS' ) + COUNTRYNAME="`gettext "Lesotho"`" + ;; + 'LT' ) + COUNTRYNAME="`gettext "Lithuania"`" + ;; + 'LU' ) + COUNTRYNAME="`gettext "Luxembourg"`" + ;; + 'LV' ) + COUNTRYNAME="`gettext "Latvia"`" + ;; + 'LY' ) + COUNTRYNAME="`gettext "Libya"`" + ;; + 'MA' ) + COUNTRYNAME="`gettext "Morocco"`" + ;; + 'MC' ) + COUNTRYNAME="`gettext "Monaco"`" + ;; + 'MD' ) + COUNTRYNAME="`gettext "Moldova"`" + ;; + 'MG' ) + COUNTRYNAME="`gettext "Madagascar"`" + ;; + 'MH' ) + COUNTRYNAME="`gettext "Marshall Islands"`" + ;; + 'MK' ) + COUNTRYNAME="`gettext "Macedonia"`" + ;; + 'ML' ) + COUNTRYNAME="`gettext "Mali"`" + ;; + 'MM' ) + COUNTRYNAME="`gettext "Myanmar (Burma)"`" + ;; + 'MN' ) + COUNTRYNAME="`gettext "Mongolia"`" + ;; + 'MO' ) + COUNTRYNAME="`gettext "Macao"`" + ;; + 'MP' ) + COUNTRYNAME="`gettext "Northern Mariana Islands"`" + ;; + 'MQ' ) + COUNTRYNAME="`gettext "Martinique"`" + ;; + 'MR' ) + COUNTRYNAME="`gettext "Mauritania"`" + ;; + 'MS' ) + COUNTRYNAME="`gettext "Montserrat"`" + ;; + 'MT' ) + COUNTRYNAME="`gettext "Malta"`" + ;; + 'MU' ) + COUNTRYNAME="`gettext "Mauritius"`" + ;; + 'MV' ) + COUNTRYNAME="`gettext "Maldives"`" + ;; + 'MW' ) + COUNTRYNAME="`gettext "Malawi"`" + ;; + 'MX' ) + COUNTRYNAME="`gettext "Mexico"`" + ;; + 'MY' ) + COUNTRYNAME="`gettext "Malaysia"`" + ;; + 'MZ' ) + COUNTRYNAME="`gettext "Mozambique"`" + ;; + 'NA' ) + COUNTRYNAME="`gettext "Namibia"`" + ;; + 'NC' ) + COUNTRYNAME="`gettext "New Caledonia"`" + ;; + 'NE' ) + COUNTRYNAME="`gettext "Niger"`" + ;; + 'NF' ) + COUNTRYNAME="`gettext "Norfolk Island"`" + ;; + 'NG' ) + COUNTRYNAME="`gettext "Nigeria"`" + ;; + 'NI' ) + COUNTRYNAME="`gettext "Nicaragua"`" + ;; + 'NL' ) + COUNTRYNAME="`gettext "Netherlands"`" + ;; + 'NO' ) + COUNTRYNAME="`gettext "Norway"`" + ;; + 'NP' ) + COUNTRYNAME="`gettext "Nepal"`" + ;; + 'NR' ) + COUNTRYNAME="`gettext "Nauru"`" + ;; + 'NU' ) + COUNTRYNAME="`gettext "Niue"`" + ;; + 'NZ' ) + COUNTRYNAME="`gettext "New Zealand"`" + ;; + 'OM' ) + COUNTRYNAME="`gettext "Oman"`" + ;; + 'PA' ) + COUNTRYNAME="`gettext "Panama"`" + ;; + 'PE' ) + COUNTRYNAME="`gettext "Peru"`" + ;; + 'PF' ) + COUNTRYNAME="`gettext "French Polynesia"`" + ;; + 'PG' ) + COUNTRYNAME="`gettext "Papua New Guinea"`" + ;; + 'PH' ) + COUNTRYNAME="`gettext "Philippines"`" + ;; + 'PK' ) + COUNTRYNAME="`gettext "Pakistan"`" + ;; + 'PL' ) + COUNTRYNAME="`gettext "Poland"`" + ;; + 'PM' ) + COUNTRYNAME="`gettext "St Pierre and Miquelon"`" + ;; + 'PN' ) + COUNTRYNAME="`gettext "Pitcairn"`" + ;; + 'PR' ) + COUNTRYNAME="`gettext "Puerto Rico"`" + ;; + 'PS' ) + COUNTRYNAME="`gettext "Palestine"`" + ;; + 'PT' ) + COUNTRYNAME="`gettext "Portugal"`" + ;; + 'PW' ) + COUNTRYNAME="`gettext "Palau"`" + ;; + 'PY' ) + COUNTRYNAME="`gettext "Paraguay"`" + ;; + 'QA' ) + COUNTRYNAME="`gettext "Qatar"`" + ;; + 'RE' ) + COUNTRYNAME="`gettext "Reunion"`" + ;; + 'RO' ) + COUNTRYNAME="`gettext "Romania"`" + ;; + 'RU' ) + COUNTRYNAME="`gettext "Russia"`" + ;; + 'RW' ) + COUNTRYNAME="`gettext "Rwanda"`" + ;; + 'SA' ) + COUNTRYNAME="`gettext "Saudi Arabia"`" + ;; + 'SB' ) + COUNTRYNAME="`gettext "Solomon Islands"`" + ;; + 'SC' ) + COUNTRYNAME="`gettext "Seychelles"`" + ;; + 'SD' ) + COUNTRYNAME="`gettext "Sudan"`" + ;; + 'SE' ) + COUNTRYNAME="`gettext "Sweden"`" + ;; + 'SG' ) + COUNTRYNAME="`gettext "Singapore"`" + ;; + 'SH' ) + COUNTRYNAME="`gettext "St Helena"`" + ;; + 'SI' ) + COUNTRYNAME="`gettext "Slovenia"`" + ;; + 'SJ' ) + COUNTRYNAME="`gettext "Svalbard and Jan Mayen"`" + ;; + 'SK' ) + COUNTRYNAME="`gettext "Slovakia"`" + ;; + 'SL' ) + COUNTRYNAME="`gettext "Sierra Leone"`" + ;; + 'SM' ) + COUNTRYNAME="`gettext "San Marino"`" + ;; + 'SN' ) + COUNTRYNAME="`gettext "Senegal"`" + ;; + 'SO' ) + COUNTRYNAME="`gettext "Somalia"`" + ;; + 'SR' ) + COUNTRYNAME="`gettext "Suriname"`" + ;; + 'ST' ) + COUNTRYNAME="`gettext "Sao Tome and Principe"`" + ;; + 'SV' ) + COUNTRYNAME="`gettext "El Salvador"`" + ;; + 'SY' ) + COUNTRYNAME="`gettext "Syria"`" + ;; + 'SZ' ) + COUNTRYNAME="`gettext "Swaziland"`" + ;; + 'TC' ) + COUNTRYNAME="`gettext "Turks and Caicos Islands"`" + ;; + 'TD' ) + COUNTRYNAME="`gettext "Chad"`" + ;; + 'TF' ) + COUNTRYNAME="`gettext "French Southern and Antarctic Lands"`" + ;; + 'TG' ) + COUNTRYNAME="`gettext "Togo"`" + ;; + 'TH' ) + COUNTRYNAME="`gettext "Thailand"`" + ;; + 'TJ' ) + COUNTRYNAME="`gettext "Tajikistan"`" + ;; + 'TK' ) + COUNTRYNAME="`gettext "Tokelau"`" + ;; + 'TL' ) + COUNTRYNAME="`gettext "Timor-Leste"`" + ;; + 'TM' ) + COUNTRYNAME="`gettext "Turkmenistan"`" + ;; + 'TN' ) + COUNTRYNAME="`gettext "Tunisia"`" + ;; + 'TO' ) + COUNTRYNAME="`gettext "Tonga"`" + ;; + 'TR' ) + COUNTRYNAME="`gettext "Turkey"`" + ;; + 'TT' ) + COUNTRYNAME="`gettext "Trinidad and Tobago"`" + ;; + 'TV' ) + COUNTRYNAME="`gettext "Tuvalu"`" + ;; + 'TW' ) + COUNTRYNAME="`gettext "Taiwan"`" + ;; + 'TZ' ) + COUNTRYNAME="`gettext "Tanzania"`" + ;; + 'UA' ) + COUNTRYNAME="`gettext "Ukraine"`" + ;; + 'UG' ) + COUNTRYNAME="`gettext "Uganda"`" + ;; + 'UM' ) + COUNTRYNAME="`gettext "US minor outlying islands"`" + ;; + 'US' ) + COUNTRYNAME="`gettext "United States"`" + ;; + 'UY' ) + COUNTRYNAME="`gettext "Uruguay"`" + ;; + 'UZ' ) + COUNTRYNAME="`gettext "Uzbekistan"`" + ;; + 'VA' ) + COUNTRYNAME="`gettext "Vatican City"`" + ;; + 'VC' ) + COUNTRYNAME="`gettext "St Vincent"`" + ;; + 'VE' ) + COUNTRYNAME="`gettext "Venezuela"`" + ;; + 'VG' ) + COUNTRYNAME="`gettext "Virgin Islands (UK)"`" + ;; + 'VI' ) + COUNTRYNAME="`gettext "Virgin Islands (US)"`" + ;; + 'VN' ) + COUNTRYNAME="`gettext "Vietnam"`" + ;; + 'VU' ) + COUNTRYNAME="`gettext "Vanuatu"`" + ;; + 'WF' ) + COUNTRYNAME="`gettext "Wallis and Futuna"`" + ;; + 'WS' ) + COUNTRYNAME="`gettext "Samoa (Western)"`" + ;; + 'YE' ) + COUNTRYNAME="`gettext "Yemen"`" + ;; + 'YT' ) + COUNTRYNAME="`gettext "Mayotte"`" + ;; + 'ZA' ) + COUNTRYNAME="`gettext "South Africa"`" + ;; + 'ZM' ) + COUNTRYNAME="`gettext "Zambia"`" + ;; + 'ZW' ) + COUNTRYNAME="`gettext "Zimbabwe"`" + ;; + * ) + COUNTRYNAME="`gettext "Unknown"`" + + esac + + echo $COUNTRYNAME + +} diff --git a/Scripts/Bash/Functions/cli_getCurrentLocale.sh b/Scripts/Bash/Functions/cli_getCurrentLocale.sh new file mode 100755 index 0000000..9181c59 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getCurrentLocale.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# cli_getCurrentLocale.sh -- This function checks LANG environment +# variable and returns the current locale information in the LL_CC +# format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getCurrentLocale { + + local CURRENTLOCALE='' + local OPTION="$1" + + # Redefine current locale using LL_CC format. + CURRENTLOCALE=$(echo $LANG | sed -r 's!(^[a-z]{2,3}_[A-Z]{2}).+$!\1!') + + # Define centos-art.sh script default current locale. If + # centos-art.sh script doesn't support current system locale, use + # English language from United States as default current locale. + if [[ $CURRENTLOCALE == '' ]];then + CURRENTLOCALE='en_US' + fi + + # Output current locale. + case $OPTION in + + '--langcode-only' ) + echo "${CURRENTLOCALE}" | cut -d_ -f1 + ;; + + '--langcode-and-countrycode'| * ) + echo "${CURRENTLOCALE}" + ;; + esac +} diff --git a/Scripts/Bash/Functions/cli_getFilesList.sh b/Scripts/Bash/Functions/cli_getFilesList.sh new file mode 100755 index 0000000..5b9ff22 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getFilesList.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# +# cli_getFilesList.sh -- This function outputs the list of files to +# process. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getFilesList { + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='pattern:,mindepth:,maxdepth:,type:,uid:' + + # Initialize arguments with an empty value and set it as local + # variable to this function scope. + local ARGUMENTS='' + + # Initialize pattern used to reduce the find output. + local PATTERN="$FLAG_FILTER" + + # Initialize options used with find command. + local OPTIONS='' + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + while true;do + case "$1" in + + --pattern ) + PATTERN="$2" + shift 2 + ;; + + --maxdepth ) + OPTIONS="$OPTIONS -maxdepth $2" + shift 2 + ;; + + --mindepth ) + OPTIONS="$OPTIONS -mindepth $2" + shift 2 + ;; + + --type ) + OPTIONS="$OPTIONS -type $2" + shift 2 + ;; + + --uid ) + OPTIONS="$OPTIONS -uid $2" + shift 2 + ;; + + -- ) + shift 1 + break + ;; + esac + done + + # At this point all options arguments have been processed and + # removed from positional parameters. Only non-option arguments + # remain so we use them as source location for find command to + # look files for. + local LOCATIONS="$@" + + # Verify locations. + cli_checkFiles ${LOCATIONS} + + # Redefine pattern as regular expression. When we use regular + # expressions with find, regular expressions are evaluated against + # the whole file path. This way, when the regular expression is + # specified, we need to build it in a way that matches the whole + # path. Doing so, everytime we pass the `--filter' option in the + # command-line could be a tedious task. Instead, in the sake of + # reducing some typing, we prepare the regular expression here to + # match the whole path using the regular expression provided by + # the user as pattern. Do not use LOCATION variable as part of + # regular expresion so it could be possible to use path expansion. + # Using path expansion reduce the amount of places to find out + # things and so the time required to finish the task. + PATTERN="^.*(/)?${PATTERN}$" + + # Define list of files to process. At this point we cannot verify + # whether the LOCATION is a directory or a file since path + # expansion coul be introduced to it. The best we can do is + # verifying exit status and go on. + find ${LOCATIONS} -regextype posix-egrep ${OPTIONS} -regex "${PATTERN}" | sort | uniq + +} diff --git a/Scripts/Bash/Functions/cli_getLangCodes.sh b/Scripts/Bash/Functions/cli_getLangCodes.sh new file mode 100755 index 0000000..59f7444 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getLangCodes.sh @@ -0,0 +1,222 @@ +#!/bin/bash +# +# cli_getLangCodes.sh -- This function outputs a list with language +# codes as defined in ISO639 standard. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getLangCodes { + + local FILTER="$(echo $1 | cut -d_ -f1)" + + LANGCODES="aa + ab + ae + af + ak + am + an + ar + as + av + ay + az + ba + be + bg + bh + bi + bm + bn + bo + br + bs + ca + ce + ch + co + cr + cs + cu + cv + cy + da + de + dv + dz + ee + el + en + eo + es + et + eu + fa + ff + fi + fj + fo + fr + fy + ga + gd + gl + gn + gu + gv + ha + he + hi + ho + hr + ht + hu + hy + hz + ia + id + ie + ig + ii + ik + io + is + it + iu + ja + jv + ka + kg + ki + kj + kk + kl + km + kn + ko + kr + ks + ku + kv + kw + ky + la + lb + lg + li + ln + lo + lt + lu + lv + mg + mh + mi + mk + ml + mn + mo + mr + ms + mt + my + na + nb + nd + ne + ng + nl + nn + no + nr + nv + ny + oc + oj + om + or + os + pa + pi + pl + ps + pt + qu + rm + rn + ro + ru + rw + sa + sc + sd + se + sg + si + sk + sl + sm + sn + so + sq + sr + ss + st + su + sv + sw + ta + te + tg + th + ti + tk + tl + tn + to + tr + ts + tt + tw + ty + ug + uk + ur + uz + ve + vi + vo + wa + wo + xh + yi + yo + za + zh + zu" + + if [[ $FILTER != '' ]];then + echo "$LANGCODES" | egrep "$FILTER" | sed -r 's![[:space:]]+!!g' + else + echo "$LANGCODES" + fi + +} diff --git a/Scripts/Bash/Functions/cli_getLangName.sh b/Scripts/Bash/Functions/cli_getLangName.sh new file mode 100755 index 0000000..6d734b2 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getLangName.sh @@ -0,0 +1,780 @@ +#!/bin/bash +# +# cli_getLangName.sh -- This function reads one language locale code +# in the format LL_CC and outputs its language name. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getLangName { + + local LANGCODE="$(echo "$1" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]')" + local LANGNAME='' + + case $LANGCODE in + + 'aa' ) + LANGNAME="`gettext "Afar"`" + ;; + + 'ab' ) + LANGNAME="`gettext "Abkhazian"`" + ;; + + 'ae' ) + LANGNAME="`gettext "Avestan"`" + ;; + + 'af' ) + LANGNAME="`gettext "Afrikaans"`" + ;; + + 'ak' ) + LANGNAME="`gettext "Akan"`" + ;; + + 'am' ) + LANGNAME="`gettext "Amharic"`" + ;; + + 'an' ) + LANGNAME="`gettext "Aragonese"`" + ;; + + 'ar' ) + LANGNAME="`gettext "Arabic"`" + ;; + + 'as' ) + LANGNAME="`gettext "Assamese"`" + ;; + + 'av' ) + LANGNAME="`gettext "Avaric"`" + ;; + + 'ay' ) + LANGNAME="`gettext "Aymara"`" + ;; + + 'az' ) + LANGNAME="`gettext "Azerbaijani"`" + ;; + + 'ba' ) + LANGNAME="`gettext "Bashkir"`" + ;; + + 'be' ) + LANGNAME="`gettext "Byelorussian"`" + ;; + + 'bg' ) + LANGNAME="`gettext "Bulgarian"`" + ;; + + 'bh' ) + LANGNAME="`gettext "Bihari"`" + ;; + + 'bi' ) + LANGNAME="`gettext "Bislama"`" + ;; + + 'bm' ) + LANGNAME="`gettext "Bambara"`" + ;; + + 'bn' ) + LANGNAME="`gettext "Bengali"`" + ;; + + 'bo' ) + LANGNAME="`gettext "Tibetan"`" + ;; + + 'br' ) + LANGNAME="`gettext "Breton"`" + ;; + + 'bs' ) + LANGNAME="`gettext "Bosnian"`" + ;; + + 'ca' ) + LANGNAME="`gettext "Catalan"`" + ;; + + 'ce' ) + LANGNAME="`gettext "Chechen"`" + ;; + + 'ch' ) + LANGNAME="`gettext "Chamorro"`" + ;; + + 'co' ) + LANGNAME="`gettext "Corsican"`" + ;; + + 'cr' ) + LANGNAME="`gettext "Cree"`" + ;; + + 'cs' ) + LANGNAME="`gettext "Czech"`" + ;; + + 'cu' ) + LANGNAME="`gettext "Church Slavic"`" + ;; + + 'cv' ) + LANGNAME="`gettext "Chuvash"`" + ;; + + 'cy' ) + LANGNAME="`gettext "Welsh"`" + ;; + + 'da' ) + LANGNAME="`gettext "Danish"`" + ;; + + 'de' ) + LANGNAME="`gettext "German"`" + ;; + + 'dv' ) + LANGNAME="`gettext "Divehi"`" + ;; + + 'dz' ) + LANGNAME="`gettext "Dzongkha"`" + ;; + + 'ee' ) + LANGNAME="`gettext "E'we"`" + ;; + + 'el' ) + LANGNAME="`gettext "Greek"`" + ;; + + 'en' ) + LANGNAME="`gettext "English"`" + ;; + + 'eo' ) + LANGNAME="`gettext "Esperanto"`" + ;; + + 'es' ) + LANGNAME="`gettext "Spanish"`" + ;; + + 'et' ) + LANGNAME="`gettext "Estonian"`" + ;; + + 'eu' ) + LANGNAME="`gettext "Basque"`" + ;; + 'fa' ) + LANGNAME="`gettext "Persian"`" + ;; + + 'ff' ) + LANGNAME="`gettext "Fulah"`" + ;; + + 'fi' ) + LANGNAME="`gettext "Finnish"`" + ;; + + 'fj' ) + LANGNAME="`gettext "Fijian"`" + ;; + + 'fo' ) + LANGNAME="`gettext "Faroese"`" + ;; + + 'fr' ) + LANGNAME="`gettext "French"`" + ;; + + 'fy' ) + LANGNAME="`gettext "Frisian"`" + ;; + + 'ga' ) + LANGNAME="`gettext "Irish"`" + ;; + + 'gd' ) + LANGNAME="`gettext "Scots"`" + ;; + + 'gl' ) + LANGNAME="`gettext "Gallegan"`" + ;; + + 'gn' ) + LANGNAME="`gettext "Guarani"`" + ;; + + 'gu' ) + LANGNAME="`gettext "Gujarati"`" + ;; + + 'gv' ) + LANGNAME="`gettext "Manx"`" + ;; + + 'ha' ) + LANGNAME="`gettext "Hausa"`" + ;; + + 'he' ) + LANGNAME="`gettext "Hebrew"`" + ;; + + 'hi' ) + LANGNAME="`gettext "Hindi"`" + ;; + + 'ho' ) + LANGNAME="`gettext "Hiri Motu"`" + ;; + + 'hr' ) + LANGNAME="`gettext "Croatian"`" + ;; + + 'ht' ) + LANGNAME="`gettext "Haitian"`" + ;; + + 'hu' ) + LANGNAME="`gettext "Hungarian"`" + ;; + + 'hy' ) + LANGNAME="`gettext "Armenian"`" + ;; + + 'hz' ) + LANGNAME="`gettext "Herero"`" + ;; + + 'ia' ) + LANGNAME="`gettext "Interlingua"`" + ;; + + 'id' ) + LANGNAME="`gettext "Indonesian"`" + ;; + + 'ie' ) + LANGNAME="`gettext "Interlingue"`" + ;; + + 'ig' ) + LANGNAME="`gettext "Igbo"`" + ;; + + 'ii' ) + LANGNAME="`gettext "Sichuan Yi"`" + ;; + + 'ik' ) + LANGNAME="`gettext "Inupiak"`" + ;; + + 'io' ) + LANGNAME="`gettext "Ido"`" + ;; + + 'is' ) + LANGNAME="`gettext "Icelandic"`" + ;; + + 'it' ) + LANGNAME="`gettext "Italian"`" + ;; + + 'iu' ) + LANGNAME="`gettext "Inuktitut"`" + ;; + + 'ja' ) + LANGNAME="`gettext "Japanese"`" + ;; + + 'jv' ) + LANGNAME="`gettext "Javanese"`" + ;; + + 'ka' ) + LANGNAME="`gettext "Georgian"`" + ;; + + 'kg' ) + LANGNAME="`gettext "Kongo"`" + ;; + + 'ki' ) + LANGNAME="`gettext "Kikuyu"`" + ;; + + 'kj' ) + LANGNAME="`gettext "Kuanyama"`" + ;; + + 'kk' ) + LANGNAME="`gettext "Kazakh"`" + ;; + + 'kl' ) + LANGNAME="`gettext "Kalaallisut"`" + ;; + + 'km' ) + LANGNAME="`gettext "Khmer"`" + ;; + + 'kn' ) + LANGNAME="`gettext "Kannada"`" + ;; + + 'ko' ) + LANGNAME="`gettext "Korean"`" + ;; + + 'kr' ) + LANGNAME="`gettext "Kanuri"`" + ;; + + 'ks' ) + LANGNAME="`gettext "Kashmiri"`" + ;; + + 'ku' ) + LANGNAME="`gettext "Kurdish"`" + ;; + + 'kv' ) + LANGNAME="`gettext "Komi"`" + ;; + + 'kw' ) + LANGNAME="`gettext "Cornish"`" + ;; + + 'ky' ) + LANGNAME="`gettext "Kirghiz"`" + ;; + + 'la' ) + LANGNAME="`gettext "Latin"`" + ;; + + 'lb' ) + LANGNAME="`gettext "Letzeburgesch"`" + ;; + + 'lg' ) + LANGNAME="`gettext "Ganda"`" + ;; + + 'li' ) + LANGNAME="`gettext "Limburgish"`" + ;; + + 'ln' ) + LANGNAME="`gettext "Lingala"`" + ;; + + 'lo' ) + LANGNAME="`gettext "Lao"`" + ;; + + 'lt' ) + LANGNAME="`gettext "Lithuanian"`" + ;; + + 'lu' ) + LANGNAME="`gettext "Luba-Katanga"`" + ;; + + 'lv' ) + LANGNAME="`gettext "Latvian"`" + ;; + + 'mg' ) + LANGNAME="`gettext "Malagasy"`" + ;; + + 'mh' ) + LANGNAME="`gettext "Marshall"`" + ;; + + 'mi' ) + LANGNAME="`gettext "Maori"`" + ;; + + 'mk' ) + LANGNAME="`gettext "Macedonian"`" + ;; + + 'ml' ) + LANGNAME="`gettext "Malayalam"`" + ;; + + 'mn' ) + LANGNAME="`gettext "Mongolian"`" + ;; + + 'mo' ) + LANGNAME="`gettext "Moldavian"`" + ;; + + 'mr' ) + LANGNAME="`gettext "Marathi"`" + ;; + + 'ms' ) + LANGNAME="`gettext "Malay"`" + ;; + + 'mt' ) + LANGNAME="`gettext "Maltese"`" + ;; + + 'my' ) + LANGNAME="`gettext "Burmese"`" + ;; + + 'na' ) + LANGNAME="`gettext "Nauru"`" + ;; + + 'nb' ) + LANGNAME="`gettext "Norwegian Bokmaal"`" + ;; + + 'nd' ) + LANGNAME="`gettext "Ndebele, North"`" + ;; + + 'ne' ) + LANGNAME="`gettext "Nepali"`" + ;; + + 'ng' ) + LANGNAME="`gettext "Ndonga"`" + ;; + + 'nl' ) + LANGNAME="`gettext "Dutch"`" + ;; + + 'nn' ) + LANGNAME="`gettext "Norwegian Nynorsk"`" + ;; + + 'no' ) + LANGNAME="`gettext "Norwegian"`" + ;; + + 'nr' ) + LANGNAME="`gettext "Ndebele, South"`" + ;; + + 'nv' ) + LANGNAME="`gettext "Navajo"`" + ;; + + 'ny' ) + LANGNAME="`gettext "Chichewa"`" + ;; + + 'oc' ) + LANGNAME="`gettext "Occitan"`" + ;; + + 'oj' ) + LANGNAME="`gettext "Ojibwa"`" + ;; + + 'om' ) + LANGNAME="`gettext "(Afan) Oromo"`" + ;; + + 'or' ) + LANGNAME="`gettext "Oriya"`" + ;; + + 'os' ) + LANGNAME="`gettext "Ossetian; Ossetic"`" + ;; + + 'pa' ) + LANGNAME="`gettext "Panjabi; Punjabi"`" + ;; + + 'pi' ) + LANGNAME="`gettext "Pali"`" + ;; + + 'pl' ) + LANGNAME="`gettext "Polish"`" + ;; + + 'ps' ) + LANGNAME="`gettext "Pashto, Pushto"`" + ;; + + 'pt' ) + LANGNAME="`gettext "Portuguese"`" + ;; + + 'qu' ) + LANGNAME="`gettext "Quechua"`" + ;; + + 'rm' ) + LANGNAME="`gettext "Rhaeto-Romance"`" + ;; + + 'rn' ) + LANGNAME="`gettext "Rundi"`" + ;; + + 'ro' ) + LANGNAME="`gettext "Romanian"`" + ;; + + 'ru' ) + LANGNAME="`gettext "Russian"`" + ;; + + 'rw' ) + LANGNAME="`gettext "Kinyarwanda"`" + ;; + + 'sa' ) + LANGNAME="`gettext "Sanskrit"`" + ;; + + 'sc' ) + LANGNAME="`gettext "Sardinian"`" + ;; + + 'sd' ) + LANGNAME="`gettext "Sindhi"`" + ;; + + 'se' ) + LANGNAME="`gettext "Northern Sami"`" + ;; + + 'sg' ) + LANGNAME="`gettext "Sango; Sangro"`" + ;; + + 'si' ) + LANGNAME="`gettext "Sinhalese"`" + ;; + + 'sk' ) + LANGNAME="`gettext "Slovak"`" + ;; + + 'sl' ) + LANGNAME="`gettext "Slovenian"`" + ;; + + 'sm' ) + LANGNAME="`gettext "Samoan"`" + ;; + + 'sn' ) + LANGNAME="`gettext "Shona"`" + ;; + + 'so' ) + LANGNAME="`gettext "Somali"`" + ;; + + 'sq' ) + LANGNAME="`gettext "Albanian"`" + ;; + + 'sr' ) + LANGNAME="`gettext "Serbian"`" + ;; + + 'ss' ) + LANGNAME="`gettext "Swati; Siswati"`" + ;; + + 'st' ) + LANGNAME="`gettext "Sesotho; Sotho, Southern"`" + ;; + + 'su' ) + LANGNAME="`gettext "Sundanese"`" + ;; + + 'sv' ) + LANGNAME="`gettext "Swedish"`" + ;; + + 'sw' ) + LANGNAME="`gettext "Swahili"`" + ;; + + 'ta' ) + LANGNAME="`gettext "Tamil"`" + ;; + + 'te' ) + LANGNAME="`gettext "Telugu"`" + ;; + + 'tg' ) + LANGNAME="`gettext "Tajik"`" + ;; + + 'th' ) + LANGNAME="`gettext "Thai"`" + ;; + + 'ti' ) + LANGNAME="`gettext "Tigrinya"`" + ;; + + 'tk' ) + LANGNAME="`gettext "Turkmen"`" + ;; + + 'tl' ) + LANGNAME="`gettext "Tagalog"`" + ;; + + 'tn' ) + LANGNAME="`gettext "Tswana; Setswana"`" + ;; + + 'to' ) + LANGNAME="`gettext "Tonga (?)"`" + ;; + + 'tr' ) + LANGNAME="`gettext "Turkish"`" + ;; + + 'ts' ) + LANGNAME="`gettext "Tsonga"`" + ;; + + + 'tt' ) + LANGNAME="`gettext "Tatar"`" + ;; + + 'tw' ) + LANGNAME="`gettext "Twi"`" + ;; + + 'ty' ) + LANGNAME="`gettext "Tahitian"`" + ;; + + 'ug' ) + LANGNAME="`gettext "Uighur"`" + ;; + + 'uk' ) + LANGNAME="`gettext "Ukrainian"`" + ;; + + 'ur' ) + LANGNAME="`gettext "Urdu"`" + ;; + + 'uz' ) + LANGNAME="`gettext "Uzbek"`" + ;; + + 've' ) + LANGNAME="`gettext "Venda"`" + ;; + + 'vi' ) + LANGNAME="`gettext "Vietnamese"`" + ;; + + 'vo' ) + LANGNAME="`gettext "Volapuk; Volapuk"`" + ;; + + 'wa' ) + LANGNAME="`gettext "Walloon"`" + ;; + + 'wo' ) + LANGNAME="`gettext "Wolof"`" + ;; + + 'xh' ) + LANGNAME="`gettext "Xhosa"`" + ;; + + 'yi' ) + LANGNAME="`gettext "Yiddish (formerly ji)"`" + ;; + + 'yo' ) + LANGNAME="`gettext "Yoruba"`" + ;; + + 'za' ) + LANGNAME="`gettext "Zhuang"`" + ;; + + 'zh' ) + LANGNAME="`gettext "Chinese"`" + ;; + + 'zu' ) + LANGNAME="`gettext "Zulu"`" + ;; + + * ) + LANGNAME="`gettext "Unknown"`" + + esac + + echo $LANGNAME; +} + diff --git a/Scripts/Bash/Functions/cli_getLocales.sh b/Scripts/Bash/Functions/cli_getLocales.sh new file mode 100755 index 0000000..853efc7 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getLocales.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# cli_getLocales.sh -- This function outputs/verifies locale codes in LL +# and LL_CC format. Combine both ISO639 and ISO3166 specification in +# order to build the final locale list. This function defines which +# translation locales are supported inside CentOS Artwork Repository. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getLocales { + + # Print locales supported by centos-art.sh script. + locale -a | egrep '^[a-z]{2,3}_[A-Z]{2}$' | sort | uniq + +} diff --git a/Scripts/Bash/Functions/cli_getPathComponent.sh b/Scripts/Bash/Functions/cli_getPathComponent.sh new file mode 100755 index 0000000..e838cf7 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getPathComponent.sh @@ -0,0 +1,131 @@ +#!/bin/bash +# +# cli_getPathComponent.sh -- This function standardizes the way +# directory structures are organized inside the working copy of CentOS +# Artwork Repository. You can use this function to retrive information +# from paths (e.g., releases, architectures and theme artistic motifs) +# or the patterns used to build the paths. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getPathComponent { + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='release,release-major,release-minor,release-pattern,architecture,architecture-pattern,motif,motif-name,motif-release,motif-pattern' + + # Initialize ARGUMENTS with an empty value and set it as local + # variable to this function scope. + local ARGUMENTS='' + + # Define release pattern. + local RELEASE="(([[:digit:]]+)(\.([[:digit:]]+)){0,1})" + + # Define architecture pattern. Make it match the architectures the + # CentOS distribution is able to be installed on. + local ARCHITECTURE="(i386|x86_64)" + + # Define pattern for themes' artistic motifs. + local THEME_MOTIF="Identity/Images/Themes/(([[:alnum:]]+)/(${RELEASE}))" + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Define location we want to apply verifications to. + local LOCATION=$(echo $@ | sed -r 's!^.*--[[:space:]](.+)$!\1!') + + # Look for options passed through positional parameters. + while true;do + + case "$1" in + + --release ) + echo "$LOCATION" | egrep "${RELEASE}" | sed -r "s!.*/${RELEASE}/.*!\1!" + shift 1 + break + ;; + + --release-major ) + echo "$LOCATION" | egrep "${RELEASE}" | sed -r "s!.*/${RELEASE}/.*!\2!" + shift 1 + break + ;; + + --release-minor ) + echo "$LOCATION" | egrep "${RELEASE}" | sed -r "s!.*/${RELEASE}/.*!\4!" + shift 1 + break + ;; + + --release-pattern ) + echo "${RELEASE}" + shift 1 + break + ;; + + --architecture ) + echo "$LOCATION" | egrep "${ARCHITECTURE}" | sed -r "s!${ARCHITECTURE}!\1!" + shift 1 + break + ;; + + --architecture-pattern ) + echo "${ARCHITECTURE}" + shift 1 + break + ;; + + --motif ) + echo "$LOCATION" | egrep "${THEME_MOTIF}" | sed -r "s!.*${THEME_MOTIF}.*!\1!" + shift 1 + break + ;; + + --motif-name ) + echo "$LOCATION" | egrep "${THEME_MOTIF}" | sed -r "s!.*${THEME_MOTIF}.*!\2!" + shift 1 + break + ;; + + --motif-release ) + echo "$LOCATION" | egrep "${THEME_MOTIF}" | sed -r "s!.*${THEME_MOTIF}.*!\3!" + shift 1 + break + ;; + + --motif-pattern ) + echo "${THEME_MOTIF}" + shift 1 + break + ;; + + esac + + done +} diff --git a/Scripts/Bash/Functions/cli_getRepoName.sh b/Scripts/Bash/Functions/cli_getRepoName.sh new file mode 100755 index 0000000..4a43eb3 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getRepoName.sh @@ -0,0 +1,133 @@ +#!/bin/bash +# +# cli_getRepoName.sh -- This function standardize file and directories +# name convenction inside the working copy of CentOS Artowrk +# Repository. As convenction, regular files are written in lower case +# and directories are written in lower case but with the first letter +# in upper case. Use this function to sanitate the name of regular +# files and directory components of paths you work with. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getRepoName { + + # Define the name we want to apply verifications to. + local NAME="$1" + + # Avoid using options as it were names. When name value is empty + # but an option is provided, the option becomes the first + # positional argument and is evaluated as it were a name which is + # something we need to prevent from happening. + if [[ $NAME =~ '^-' ]];then + return + fi + + # Look for options passed through positional parameters. + case "$2" in + + -f|--basename ) + + # Reduce the path passed to use just the non-directory + # part of it (i.e., the last component in the path; _not_ + # the last "real" directory in the path). + NAME=$(basename $NAME) + + # Clean value. + NAME=$(echo $NAME \ + | tr -s ' ' '_' \ + | tr '[:upper:]' '[:lower:]') + ;; + + -d|--dirname ) + + local DIR='' + local DIRS='' + local CLEANDIRS='' + local PREFIXDIR='' + + # In order to sanitate each directory in a path, it is + # required to break off the path string so each component + # can be worked out individually and later combine them + # back to create a clean path string. + + # Reduce path information passed to use the directory part + # of it only. Of course, this is applied if there is a + # directory part in the path. Assuming there is no + # directory part but a non-empty value in the path, use + # that value as directory part and clean it up. + if [[ $NAME =~ '.+/.+' ]];then + + # When path information is reduced, we need to + # consider that absolute paths contain some + # directories outside the working copy directory + # structure that shouldn't be sanitated (e.g., /home, + # /home/centos, /home/centos/artwork, + # /home/centos/artwork/turnk, trunk, etc.) So, we keep + # them unchaged for later use. + PREFIXDIR=$(echo $NAME \ + | sed -r "s,^(($(cli_getRepoTLDir)/)?(trunk|branches|tags)/).+$,\1,") + + # ... and remove them from the path information we do + # want to sanitate. + DIRS=$(dirname "$NAME" \ + | sed -r "s!^${PREFIXDIR}!!" \ + | tr '/' ' ') + + else + + # At this point, there is not directory part in the + # information passed, so use the value passed as + # directory part as such. + DIRS=$NAME + + fi + + for DIR in $DIRS;do + + # Sanitate directory component. + if [[ $DIR =~ '^[a-z]' ]];then + DIR=$(echo ${DIR} \ + | tr -s ' ' '_' \ + | tr '[:upper:]' '[:lower:]' \ + | sed -r 's/^([[:alpha:]])/\u\1/') + fi + + # Rebuild path using sanitated values. + CLEANDIRS="${CLEANDIRS}/$DIR" + + done + + # Redefine path using sanitated values. + NAME=$(echo ${CLEANDIRS} | sed -r "s!^/!!") + + # Add prefix directory information to sanitated path + # information. + if [[ "$PREFIXDIR" != '' ]];then + NAME=${PREFIXDIR}${NAME} + fi + ;; + + esac + + # Print out the clean path string. + echo $NAME + +} diff --git a/Scripts/Bash/Functions/cli_getRepoParallelDirs.sh b/Scripts/Bash/Functions/cli_getRepoParallelDirs.sh new file mode 100755 index 0000000..f2d0bc8 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getRepoParallelDirs.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# cli_getRepoParallelDirs.sh -- This function returns the parallel +# directories related to the first positional paramenter passed as +# parent directory. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getRepoParallelDirs { + + local BOND='' + local TDIR='' + local -a PDIRS + + # Define bond string using first positional parameter as + # reference. + if [[ "$1" != '' ]];then + BOND="$1" + elif [[ "$ACTIONVAL" != '' ]];then + BOND="$ACTIONVAL" + else + cli_printMessage "`gettext "The bond string is required."`" --as-error-line + fi + + # Define repository top level directory. + TDIR=$(cli_getRepoTLDir ${BOND}) + + # Define parallel directory base structures. + PDIRS[0]=Manuals/$(cli_getCurrentLocale)/Texinfo/Repository/$(cli_getRepoTLDir ${BOND} --relative) + PDIRS[1]=Scripts/Bash/Functions/Render/Config + PDIRS[2]=L10n + + # Redefine bond string without its top level directory structure. + BOND=$(echo $BOND | sed -r "s,^${TDIR}/(.+)$,\1,") + + # Concatenate repository top level directory, parallel directory + # base structure, and bond information; in order to produce the + # final parallel directory path. + for PDIR in "${PDIRS[@]}";do + echo ${TDIR}/${PDIR}/${BOND} + done + +} diff --git a/Scripts/Bash/Functions/cli_getRepoStatus.sh b/Scripts/Bash/Functions/cli_getRepoStatus.sh new file mode 100755 index 0000000..dca042f --- /dev/null +++ b/Scripts/Bash/Functions/cli_getRepoStatus.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# cli_getRepoStatus.sh -- This function requests the working copy +# using the svn status command and returns the first character in the +# output line, as described in svn help status, for the LOCATION +# specified. Use this function to perform verifications based a +# repository LOCATION status. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getRepoStatus { + + local LOCATION="$1" + + # Define regular expression pattern to retrive first column, + # returned by subversion status command. This column is one + # character column as describes `svn help status' command. + local PATTERN='^( |A|C|D|I|M|R|X|!|~).+$' + + # Output specific state of location using subversion `status' + # command. + svn status "$LOCATION" --quiet | sed -r "s/${PATTERN}/\1/" + +} diff --git a/Scripts/Bash/Functions/cli_getRepoTLDir.sh b/Scripts/Bash/Functions/cli_getRepoTLDir.sh new file mode 100755 index 0000000..bc30f2c --- /dev/null +++ b/Scripts/Bash/Functions/cli_getRepoTLDir.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# +# cli_getRepoTLDir.sh -- This function returns the repository top +# level absolute path. The repository top level absolute path can be +# either ${CLI_WRKCOPY}/trunk, ${CLI_WRKCOPY}/branches, or +# ${CLI_WRKCOPY}/tags. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getRepoTLDir { + + # Define short options. + local ARGSS='r' + + # Define long options. + local ARGSL='relative' + + # Initialize arguments with an empty value and set it as local + # variable to this function scope. + local ARGUMENTS='' + + # Initialize path pattern and replacement. + local PATTERN='' + local REPLACE='' + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Define the location we want to apply verifications to. + local LOCATION=$(echo $@ | sed -r 's!^.*--[[:space:]](.+)$!\1!') + + # Verify location passed as non-option argument. If no location is + # passed as non-option argument to this function, then set the + # trunk directory structure as default location. + if [[ $LOCATION =~ '--$' ]];then + LOCATION=${CLI_WRKCOPY}/trunk + fi + + # Verify location where the working copy should be stored in the + # workstations. Whatever the location provided be, it should refer + # to one of the top level directories inside the working copy of + # CentOS Artwork Repository which, in turn, should be sotred in + # the `artwork' directory immediatly under your home directory. + if [[ ! $LOCATION =~ "^${CLI_WRKCOPY}/(trunk|branches|tags)" ]];then + cli_printMessage "`eval_gettext "The location \\\"\\\$LOCATION\\\" is not valid."`" --as-error-line + fi + + # Look for options passed through positional parameters. + while true;do + + case "$1" in + + -r|--relative ) + PATTERN="^${CLI_WRKCOPY}/(trunk|branches|tags)/.+$" + REPLACE='\1' + shift 2 + break + ;; + + -- ) + PATTERN="^(${CLI_WRKCOPY}/(trunk|branches|tags))/.+$" + REPLACE='\1' + shift 1 + break + ;; + esac + + done + + # Print out top level directory. + echo $LOCATION | sed -r "s!${PATTERN}!${REPLACE}!g" + +} diff --git a/Scripts/Bash/Functions/cli_getTTFont.sh b/Scripts/Bash/Functions/cli_getTTFont.sh new file mode 100755 index 0000000..d6b0cd8 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getTTFont.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# +# cli_getFont.sh -- This function creates a list of all True Type +# Fonts (TTF) installed in your workstation and returns the absolute +# path of the file matching the pattern passed as first argument. +# Assuming more than one value matches, the first one in the list is +# used. In case no match is found, the function verifies if there is +# any file in the list that can be used (giving preference to sans +# files). If no file is found at this point, an error will be printed +# out. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getTTFont { + + local -a FONT_PATTERNS + local FONT_PATTERN='' + local FONT_FILE='' + + # Define list of patterns used to build the list of TTF files. + FONT_PATTERNS[((++${#FONT_PATTERNS[*]}))]="/${1}\.ttf$" + FONT_PATTERNS[((++${#FONT_PATTERNS[*]}))]="sans\.ttf$" + FONT_PATTERNS[((++${#FONT_PATTERNS[*]}))]="\.ttf$" + + # Define directory location where fonts are installed in your + # workstation. + local FONT_DIR='/usr/share/fonts' + + # Define list of all TTF files installed in your workstation. + local FONT_FILES=$(cli_getFilesList ${FONT_DIR} --pattern="\.ttf") + + # Define TTF absolute path based on pattern. Notice that if the + # pattern matches more than one value, only the first one of a + # sorted list will be used. + for FONT_PATTERN in ${FONT_PATTERNS[@]};do + + FONT_FILE=$(echo "$FONT_FILES" | egrep ${FONT_PATTERN} \ + | head -n 1) + + if [[ -f $FONT_FILE ]];then + break + fi + + done + + # Output TTF absolute path. + if [[ -f $FONT_FILE ]];then + echo $FONT_FILE + else + cli_printMessage "`gettext "The font provided doesn't exist."`" --as-error-line + fi + +} diff --git a/Scripts/Bash/Functions/cli_getTemporalFile.sh b/Scripts/Bash/Functions/cli_getTemporalFile.sh new file mode 100755 index 0000000..9322da1 --- /dev/null +++ b/Scripts/Bash/Functions/cli_getTemporalFile.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# cli_getTemporalFile.sh -- This function returns the absolute path +# you need to use to create temporal files. Use this function whenever +# you need to create temporal files inside centos-art.sh script. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getTemporalFile { + + # Define base name for temporal file. This is required when svg + # instances are created previous to be parsed by inkscape in order + # to be exported as png. In such cases .svg file exention is + # required in order to avoid complains from inkscape. + local NAME="$(cli_getRepoName $1 -f)" + + # Check default base name for temporal file, it can't be an empty + # value. + if [[ "$NAME" == '' ]];then + cli_printMessage "`gettext "The first argument cannot be empty."`" --as-error-line + fi + + # Redefine file name for the temporal file. Make it a combination + # of the program name, the program process id, a random string and + # the design model name. Using the program name and process id in + # the file name let us to relate both the shell script execution + # and the temporal files it creates, so they can be removed in + # case an interruption signal be detected. The random string let + # us to produce the same artwork in different terminals at the + # same time. the The design model name provides file + # identification. + NAME=${CLI_PROGRAM}-${CLI_PROGRAM_ID}-${RANDOM}-${NAME} + + # Define absolute path for temporal file using the program name, + # the current locale, the unique identifier and the file name. + local TEMPFILE="${CLI_TEMPDIR}/${NAME}" + + # Output absolute path to final temporal file. + echo $TEMPFILE + +} diff --git a/Scripts/Bash/Functions/cli_isLocalized.sh b/Scripts/Bash/Functions/cli_isLocalized.sh new file mode 100755 index 0000000..efce7f8 --- /dev/null +++ b/Scripts/Bash/Functions/cli_isLocalized.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# cli_isLocalized.sh -- This function determines whether a file or +# directory can have translation messages or not. This is the way we +# standardize what locations can be localized and what cannot inside +# the repository. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_isLocalized { + + local DIR='' + local -a DIRS + + # Initialize default value returned by this function. + local LOCALIZED='false' + + # Initialize location will use as reference to determine whether + # it can have translation messages or not. + local LOCATION="$1" + + # Redefine location to be sure we'll always evaluate a directory, + # as reference location. + if [[ -f $LOCATION ]];then + LOCATION=$(dirname $LOCATION) + fi + + # Verify location existence. If it doesn't exist we cannot go on. + cli_checkFiles $LOCATION -d + + # Define regular expresion list of all directories inside the + # repository that can have translation. These are the + # locale-specific directories will be created for. + DIRS[++((${#DIRS[*]}))]="$(cli_getRepoTLDir)/Identity/Models/Themes/[[:alnum:]-]+/(Distro/$(\ + cli_getPathComponent --release-pattern)/Anaconda|Concept|Posters|Media)" + DIRS[++((${#DIRS[*]}))]="$(cli_getRepoTLDir)/Manuals/[[:alnum:]-]+$" + DIRS[++((${#DIRS[*]}))]="$(cli_getRepoTLDir)/Scripts$" + + # Verify location passed as first argument agains the list of + # directories that can have translation messages. By default, the + # location passed as first argument is considered as a location + # that cannot have translation messages until a positive answer + # says otherwise. + for DIR in ${DIRS[@]};do + if [[ $LOCATION =~ $DIR ]];then + LOCALIZED='true' + break + fi + done + + # Output final answer to all verifications. + echo "$LOCALIZED" + +} diff --git a/Scripts/Bash/Functions/cli_isVersioned.sh b/Scripts/Bash/Functions/cli_isVersioned.sh new file mode 100755 index 0000000..a1f7f97 --- /dev/null +++ b/Scripts/Bash/Functions/cli_isVersioned.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# cli_isVersioned.sh -- This function determines whether a location is +# under version control or not. When the location is under version +# control, this function returns `true'. when the location isn't under +# version control, this function returns `false'. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_isVersioned { + + # Initialize absolute path using first positional parameter as + # reference. + local LOCATION="$1" + + # Verify location to be sure it really exists. + cli_checkFiles $LOCATION + + # Use subversion to determine whether the location is under + # version control or not. + svn info $LOCATION &> /dev/null + + # Verify subversion exit status and print output. + if [[ $? -eq 0 ]];then + echo 'true' + else + echo 'false' + fi + +} diff --git a/Scripts/Bash/Functions/cli_parseArguments.sh b/Scripts/Bash/Functions/cli_parseArguments.sh new file mode 100755 index 0000000..2adb19b --- /dev/null +++ b/Scripts/Bash/Functions/cli_parseArguments.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# cli_parseArguments.sh -- This function redefines arguments +# (ARGUMENTS) global variable using getopt(1) output. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_parseArguments { + + # Reset positional parameters using optional arguments. + eval set -- "$ARGUMENTS" + + # Parse optional arguments using getopt. + ARGUMENTS=$(getopt -o "$ARGSS" -l "$ARGSL" -n "$CLI_PROGRAM (${FUNCNAME[1]})" -- "$@") + + # Be sure getout parsed arguments successfully. + if [[ $? != 0 ]]; then + cli_printMessage "${CLI_FUNCDIRNAM}" --as-toknowmore-line + fi + +} diff --git a/Scripts/Bash/Functions/cli_parseArgumentsReDef.sh b/Scripts/Bash/Functions/cli_parseArgumentsReDef.sh new file mode 100755 index 0000000..6a6c4c0 --- /dev/null +++ b/Scripts/Bash/Functions/cli_parseArgumentsReDef.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# +# cli_parseArgumentsReDef.sh -- This function initiates/reset and +# sanitates positional parameters passed to this function and creates +# the the list of arguments that getopt will process. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_parseArgumentsReDef { + + local ARG + + # Clean up arguments global variable. + ARGUMENTS='' + + # Fill up arguments global variable with current positional + # parameter information. To avoid interpretation problems, use + # single quotes to enclose each argument (ARG) from command-line + # idividually. + for ARG in "$@"; do + + # Sanitate option arguments before process them. Be sure that + # no option argument does contain any single quote (U+0027) + # inside; that would break option parsing. Remember that we + # are using single quotes to enclose option arguments in order + # to let getopt to interpret option arguments with spaces + # inside. To solve this issue, we replace all single quotes + # in the arguments list with their respective codification and + # reverse the process back when doPrint them out. + ARG=$(echo $ARG | sed "s/'/\\\0x27/g") + + # Concatenate arguments and encolose them to let getopt to + # process them when they have spaces inside. + ARGUMENTS="$ARGUMENTS '$ARG'" + + done + +} diff --git a/Scripts/Bash/Functions/cli_printActionPreamble.sh b/Scripts/Bash/Functions/cli_printActionPreamble.sh new file mode 100755 index 0000000..c8270bc --- /dev/null +++ b/Scripts/Bash/Functions/cli_printActionPreamble.sh @@ -0,0 +1,146 @@ +#!/bin/bash +# +# cli_printActionPreamble -- This function standardizes the way +# preamble messages are printed out. Preamble messages are used before +# actions (e.g., file elimination, edition, creation, actualization, +# etc.) and provide a way for the user to control whether the action +# is performed or not. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_printActionPreamble { + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='to-create,to-delete,to-locale,to-edit' + + # Initialize arguments with an empty value and set it as local + # variable to this function scope. + local ARGUMENTS='' + + # Initialize message. + local MESSAGE='' + + # Initialize message options. + local OPTION='' + + # Initialize file variable as local to avoid conflicts outside. + # We'll use the file variable later, to show the list of files + # that will be affected by the action. + local FILE='' + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Define the location we want to apply verifications to. + local FILES=$(echo $@ | sed -r 's!^.*--[[:space:]](.+)$!\1!') + + # Initialize counter with total number of files. + local COUNT=$(echo $FILES | wc -l) + + # Look for options passed through positional parameters. + while true;do + + case "$1" in + + --to-create ) + if [[ $FILES == '--' ]];then + MESSAGE="`gettext "There is no entry to create."`" + OPTION='--as-error-line' + else + MESSAGE="`ngettext "The following entry will be created" \ + "The following entries will be created" $COUNT`:" + OPTION='' + fi + shift 2 + break + ;; + + --to-delete ) + if [[ $FILES == '--' ]];then + MESSAGE="`gettext "There is no file to delete."`" + OPTION='--as-error-line' + else + MESSAGE="`ngettext "The following entry will be deleted" \ + "The following entries will be deleted" $COUNT`:" + OPTION='' + fi + shift 2 + break + ;; + + --to-locale ) + if [[ $FILES == '--' ]];then + MESSAGE="`gettext "There is no file to locale."`" + OPTION='--as-error-line' + else + MESSAGE="`ngettext "Translatable strings will be retrived from the following entry" \ + "Translatable strings will be retrived from the following entries" $COUNT`:" + OPTION='' + fi + shift 2 + break + ;; + + --to-edit ) + if [[ $FILES == '--' ]];then + MESSAGE="`gettext "There is no file to edit."`" + OPTION='--as-error-line' + else + MESSAGE="`ngettext "The following file will be edited" \ + "The following files will be edited" $COUNT`:" + OPTION='' + fi + shift 2 + break + ;; + + -- ) + if [[ $FILES == '--' ]];then + MESSAGE="`gettext "There is no file to process."`" + OPTION='--as-error-line' + else + MESSAGE="`ngettext "The following file will be processed" \ + "The following files will be processed" $COUNT`:" + OPTION='' + fi + shift 1 + break + ;; + esac + done + + # Print out the preamble message. + cli_printMessage "${MESSAGE}" "${OPTION}" + for FILE in $FILES;do + cli_printMessage "$FILE" --as-response-line + done + cli_printMessage "`gettext "Do you want to continue"`" --as-yesornorequest-line + +} diff --git a/Scripts/Bash/Functions/cli_printCopyrightInfo.sh b/Scripts/Bash/Functions/cli_printCopyrightInfo.sh new file mode 100755 index 0000000..6f4e6e2 --- /dev/null +++ b/Scripts/Bash/Functions/cli_printCopyrightInfo.sh @@ -0,0 +1,118 @@ +#!/bin/bash +# +# cli_printCopyrightInfo.sh -- This function standardizes the +# copyright information used by centos-art.sh script. +# +# As far as I understand, the copyright exists to make people create +# more. The copyright gives creators the legal power over their +# creations and so the freedom to distribute them under the ethical +# terms the creator considers better. At this moment I don't feel +# very confident about this legal affairs and their legal +# implications, but I need to decide what copyright information the +# centos-art.sh script will print out. So, in that sake, I'll assume +# the same copyright information used by The CentOS Wiki +# (http://wiki.centos.org/) as reference. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_printCopyrightInfo { + + case "$1" in + + --license ) + + # Print out the name of the license used by to release the + # content produced by centos-art.sh script, inside CentOS + # Artwork Repository. + echo "`gettext "Creative Common Attribution-ShareAlike 3.0 License"`" + ;; + + --license-url ) + + # Print out the url of the license used by to release the + # content produced by centos-art.sh script, inside CentOS + # Artwork Repository. + cli_printUrl --cc-sharealike + ;; + + --copyright-year-first ) + + # The former year when I (as part of The CentOS Project) + # started to consolidate The CentOS Project Corporate + # Visual Identity through the CentOS Artwork Repository. + echo '2009' + ;; + + --copyright-year|--copyright-year-last ) + + # The last year when The CentOS Project stopped working in + # its Corporate Visual Identity through the CentOS Artwork + # Repository. That is something that I hope does never + # happen, so assume the current year as last working year. + date +%Y + ;; + + --copyright-year-range ) + + local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first') + local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last') + echo "${FIRST_YEAR}-${LAST_YEAR}" + ;; + + --copyright-year-list ) + + local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first') + local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last') + + # Define full copyright year string based on first and + # last year. + local FULL_YEAR=$(\ + while [[ ${FIRST_YEAR} -le ${LAST_YEAR} ]];do + echo -n "${FIRST_YEAR}, " + FIRST_YEAR=$(($FIRST_YEAR + 1)) + done) + + # Prepare full copyright year string and print it out. + echo "${FULL_YEAR}" | sed 's!, *$!!' + ;; + + --copyright-holder ) + + # Output default copyright holder. + echo "`gettext "The CentOS Project"`" + ;; + + --copyright-holder-predicate ) + + local HOLDER=$(cli_printCopyrightInfo '--copyright-holder') + echo "${HOLDER}. `gettext "All rights reserved."`" + ;; + + --copyright ) + + local YEAR=$(cli_printCopyrightInfo '--copyright-year-last') + local HOLDER=$(cli_printCopyrightInfo '--copyright-holder') + echo "Copyright © ${YEAR} ${HOLDER}" + ;; + + esac + +} diff --git a/Scripts/Bash/Functions/cli_printMessage.sh b/Scripts/Bash/Functions/cli_printMessage.sh new file mode 100755 index 0000000..d0366b5 --- /dev/null +++ b/Scripts/Bash/Functions/cli_printMessage.sh @@ -0,0 +1,242 @@ +#!/bin/bash +# +# cli_printMessage.sh -- This function standardizes the way messages +# are printed out from centos-art.sh script. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_printMessage { + + # Verify `--quiet' option. + if [[ "$FLAG_QUIET" == 'true' ]];then + return + fi + + local MESSAGE="$1" + local FORMAT="$2" + + # Verify message variable, it cannot have an empty value. + if [[ $MESSAGE == '' ]];then + cli_printMessage "`gettext "The message cannot be empty."`" --as-error-line + fi + + # Define message horizontal width. This is the max number of + # horizontal characters the message will use to be displayed on + # the screen. + local MESSAGE_WIDTH=66 + + # Reverse the codification performed on characters that may affect + # parsing options and non-option arguments. This codification is + # realized before building the ARGUMENTS variable, at + # cli_parseArgumentsReDef, and we need to reverse it back here + # in order to show the correct character when the message be + # printed out on the screen. + MESSAGE=$(echo $MESSAGE | sed -e "s/\\\0x27/'/g") + + # Remove empty spaces from message. + MESSAGE=$(echo $MESSAGE | sed -e 's!^[[:space:]]+!!') + + # Print out messages based on format. + case "$FORMAT" in + + --as-separator-line ) + + # Build the separator line. + MESSAGE=$(\ + until [[ $MESSAGE_WIDTH -eq 0 ]];do + echo -n "$MESSAGE" + MESSAGE_WIDTH=$(($MESSAGE_WIDTH - 1)) + done) + + # Draw the separator line. + echo "$MESSAGE" > /dev/stderr + ;; + + --as-banner-line ) + cli_printMessage '-' --as-separator-line + cli_printMessage "$MESSAGE" + cli_printMessage '-' --as-separator-line + ;; + + --as-cropping-line ) + cli_printMessage "`gettext "Cropping from"`: $MESSAGE" + ;; + + --as-tuningup-line ) + cli_printMessage "`gettext "Tuning-up"`: $MESSAGE" + ;; + + --as-checking-line ) + cli_printMessage "`gettext "Checking"`: $MESSAGE" + ;; + + --as-creating-line | --as-updating-line ) + if [[ -a "$MESSAGE" ]];then + cli_printMessage "`gettext "Updating"`: $MESSAGE" + else + cli_printMessage "`gettext "Creating"`: $MESSAGE" + fi + ;; + + --as-deleting-line ) + cli_printMessage "`gettext "Deleting"`: $MESSAGE" + ;; + + --as-reading-line ) + cli_printMessage "`gettext "Reading"`: $MESSAGE" + ;; + + --as-savedas-line ) + cli_printMessage "`gettext "Saved as"`: $MESSAGE" + ;; + + --as-linkto-line ) + cli_printMessage "`gettext "Linked to"`: $MESSAGE" + ;; + + --as-movedto-line ) + cli_printMessage "`gettext "Moved to"`: $MESSAGE" + ;; + + --as-translation-line ) + cli_printMessage "`gettext "Translation"`: $MESSAGE" + ;; + + --as-validating-line ) + cli_printMessage "`gettext "Validating"`: $MESSAGE" + ;; + + --as-template-line ) + cli_printMessage "`gettext "Template"`: $MESSAGE" + ;; + + --as-configuration-line ) + cli_printMessage "`gettext "Configuration"`: $MESSAGE" + ;; + + --as-palette-line ) + cli_printMessage "`gettext "Palette"`: $MESSAGE" + ;; + + --as-response-line ) + cli_printMessage "--> $MESSAGE" + ;; + + --as-request-line ) + cli_printMessage "${MESSAGE}:\040" --as-notrailingnew-line + ;; + + --as-selection-line ) + local NAME='' + select NAME in ${MESSAGE};do + echo $NAME + break + done + ;; + + --as-error-line ) + # Define where the error was originated inside the + # centos-art.sh script. Print out the function name and + # line from the caller. + local ORIGIN="$(caller 1 | gawk '{ print $2 " " $1 }')" + + # Build the error message. + cli_printMessage "${CLI_PROGRAM} (${ORIGIN}): $MESSAGE" --as-stderr-line + cli_printMessage "${CLI_FUNCDIRNAM}" --as-toknowmore-line + ;; + + --as-toknowmore-line ) + cli_printMessage '-' --as-separator-line + cli_printMessage "`gettext "To know more, run the following command"`:" + cli_printMessage "centos-art help --read trunk/Scripts/Functions/$MESSAGE" + cli_printMessage '-' --as-separator-line + exit # <-- ATTENTION: Do not remove this line. We use this + # option as convenction to end script + # execution. + ;; + + --as-yesornorequest-line ) + # Define positive answer. + local Y="`gettext "yes"`" + + # Define negative answer. + local N="`gettext "no"`" + + # Define default answer. + local ANSWER=${N} + + if [[ $FLAG_ANSWER == 'true' ]];then + + ANSWER=${Y} + + else + + # Print the question. + cli_printMessage "$MESSAGE [${Y}/${N}]:\040" --as-notrailingnew-line + + # Redefine default answer based on user's input. + read ANSWER + + fi + + # Verify user's answer. Only positive answer let the + # script flow to continue. Otherwise, if something + # different from possitive answer is passed, the script + # terminates its execution immediatly. + if [[ ! ${ANSWER} =~ "^${Y}" ]];then + exit + fi + ;; + + --as-notrailingnew-line ) + echo -e -n "$MESSAGE" > /dev/stderr + ;; + + --as-stdout-line ) + echo "$MESSAGE" + ;; + + --as-stderr-line ) + echo "$MESSAGE" + ;; + + * ) + + # Default printing format. This is the format used when no + # other specification is passed to this function. As + # convenience, we transform absolute paths into relative + # paths in order to free horizontal space on final output + # messages. + echo "$MESSAGE" | sed -r \ + -e "s!${CLI_WRKCOPY}/(trunk|branches|tags)/!\1/!g" \ + | awk 'BEGIN { FS=": " } + { + if ( $0 ~ /^-+$/ ) + print $0 + else + printf "%-15s\t%s\n", $1, $2 + } + END {}' > /dev/stderr + ;; + + esac + +} diff --git a/Scripts/Bash/Functions/cli_printUrl.sh b/Scripts/Bash/Functions/cli_printUrl.sh new file mode 100755 index 0000000..5994d8d --- /dev/null +++ b/Scripts/Bash/Functions/cli_printUrl.sh @@ -0,0 +1,138 @@ +#!/bin/bash +# +# cli_printUrl.sh -- This function standardize the way URLs are +# printed inside centos-art.sh script. This function describes the +# domain organization of The CentOS Project through its URLs and +# provides a way to print them out when needed. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_printUrl { + + local URL='' + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='home,lists,wiki,forums,bugs,planet,docs,mirrors,irc,projects,projects-artwork,cc-sharealike,with-locale,as-html-link' + + # Define ARGUMENTS as local variable in order to parse options + # internlally. + local ARGUMENTS='' + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + case "$1" in + + --home ) + URL='http://www.centos.org/' + shift 1 + ;; + + --lists ) + URL='http://lists.centos.org/' + shift 1 + ;; + + --wiki ) + URL='http://wiki.centos.org/' + shift 1 + ;; + + --forums ) + URL='http://forums.centos.org/' + shift 1 + ;; + + --bugs ) + URL='http://bugs.centos.org/' + shift 1 + ;; + + --projects ) + URL='https://projects.centos.org/' + shift 1 + ;; + + --projects-artwork ) + URL=$(cli_printUrl '--projects')svn/artwork/ + shift 1 + ;; + + --planet ) + URL='http://planet.centos.org/' + shift 1 + ;; + + --docs ) + URL='http://docs.centos.org/' + shift 1 + ;; + + --mirrors ) + URL='http://mirrors.centos.org/' + shift 1 + ;; + + --irc ) + URL='http://www.centos.org/modules/tinycontent/index.php?id=8' + shift 1 + ;; + + --cc-sharealike ) + URL="http://creativecommons.org/licenses/by-sa/3.0/" + shift 1 + ;; + + --with-locale ) + if [[ ! $(cli_getCurrentLocale) =~ '^en' ]];then + URL="${URL}$(cli_getCurrentLocale '--langcode-only')/" + fi + shift 1 + ;; + + --as-html-link ) + URL="${URL}" + shift 1 + ;; + + -- ) + + shift 1 + break + ;; + esac + done + + # Print Url. + echo "$URL" + +} diff --git a/Scripts/Bash/Functions/cli_syncroRepoChanges.sh b/Scripts/Bash/Functions/cli_syncroRepoChanges.sh new file mode 100755 index 0000000..168ee6b --- /dev/null +++ b/Scripts/Bash/Functions/cli_syncroRepoChanges.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# cli_syncroRepoChanges.sh -- This function syncronizes both central +# repository and working copy performing a subversion update command +# first and a subversion commit command later. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_syncroRepoChanges { + + # Verify don't commit changes flag. + if [[ $FLAG_DONT_COMMIT_CHANGES != 'false' ]];then + return + fi + + # Define source location the subversion update action will take + # place on. If arguments are provided use them as srouce location. + # Otherwise use action value as default source location. + if [[ "$@" != '' ]];then + LOCATIONS="$@" + else + LOCATIONS="$ACTIONVAL" + fi + + # Bring changes from the repository into the working copy. + cli_updateRepoChanges "$LOCATIONS" + + # Check changes in the working copy. + cli_commitRepoChanges "$LOCATIONS" + +} diff --git a/Scripts/Bash/Functions/cli_terminateScriptExecution.sh b/Scripts/Bash/Functions/cli_terminateScriptExecution.sh new file mode 100755 index 0000000..fd65ab4 --- /dev/null +++ b/Scripts/Bash/Functions/cli_terminateScriptExecution.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# cli_terminateScriptExecution.sh -- This function standardizes the +# actions that must be realized just before leaving the script +# execution (e.g., cleaning temporal files). This function is the one +# called when interruption signals like EXIT, SIGHUP, SIGINT and +# SIGTERM are detected. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_terminateScriptExecution { + + # Build list of temporal files related to this script execution. + # Remember that inside `/tmp' directory there are files and + # directories you might have no access to (due permission + # restrictions), so command cli_getFilesList to look for files in + # the first level of files that you are owner of. Otherwise, + # undesired `permission denied' messages might be output. + local FILES=$(cli_getFilesList ${CLI_TEMPDIR} \ + --pattern="${CLI_PROGRAM}-${CLI_PROGRAM_ID}-.+" \ + --maxdepth="1" --uid="$(id -u)") + + # Remove list of temporal files related to this script execution, + # if any of course. Remember that some of the temporal files can + # be directories, too. + if [[ $FILES != '' ]];then + rm -rf $FILES + fi + + # Terminate script correctly. + exit 0 + +} diff --git a/Scripts/Bash/Functions/cli_unsetFunctions.sh b/Scripts/Bash/Functions/cli_unsetFunctions.sh new file mode 100755 index 0000000..0977480 --- /dev/null +++ b/Scripts/Bash/Functions/cli_unsetFunctions.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# cli_unsetFunctions.sh -- This function unsets funtionalities from +# `centos-art.sh' script execution evironment. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_unsetFunctions { + + # Define source location where function files are placed in. + local LOCATION=$1 + + # Define suffix used to retrive function files. + local SUFFIX=$2 + + # Verify suffix value used to retrive function files. Assuming no + # suffix value is passed as second argument to this function, use + # the function name value (CLI_FUNCNAME) as default value. + if [[ $SUFFIX == '' ]];then + SUFFIX=$CLI_FUNCNAME + fi + + # Define list of backend-specific functionalities. This is the + # list of function definitions previously exported by + # `cli_exportFunctions'. Be sure to limit the list to function + # names that start with the suffix specified only. + local FUNCDEF='' + local FUNCDEFS=$(declare -F | gawk '{ print $3 }' | egrep "^${SUFFIX}") + + # Unset function names from current execution environment. + for FUNCDEF in $FUNCDEFS;do + unset -f $FUNCDEF + done + +} diff --git a/Scripts/Bash/Functions/cli_updateRepoChanges.sh b/Scripts/Bash/Functions/cli_updateRepoChanges.sh new file mode 100755 index 0000000..78a6ad4 --- /dev/null +++ b/Scripts/Bash/Functions/cli_updateRepoChanges.sh @@ -0,0 +1,101 @@ +#!/bin/bash +# +# cli_updateRepoChanges.sh -- This function realizes a subversion +# update command against the working copy in order to bring changes +# from the central repository into the working copy. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_updateRepoChanges { + + # Verify don't commit changes flag. + if [[ $FLAG_DONT_COMMIT_CHANGES != 'false' ]];then + return + fi + + local -a FILES + local -a INFO + local -a FILESNUM + local COUNT=0 + local UPDATEOUT='' + local PREDICATE='' + local CHNGTOTAL=0 + local LOCATIONS='' + + # Define source location the subversion update action will take + # place on. If arguments are provided use them as srouce location. + # Otherwise use action value as default source location. + if [[ "$@" != '' ]];then + LOCATIONS="$@" + else + LOCATIONS="$ACTIONVAL" + fi + + # Update working copy and retrive update output. + cli_printMessage "`gettext "Bringing changes from the repository into the working copy"`" --as-banner-line + UPDATEOUT=$(svn update ${LOCATIONS}) + + # Define path of files considered recent modifications from + # central repository to working copy. + FILES[0]=$(echo "$UPDATEOUT" | egrep "^A.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[1]=$(echo "$UPDATEOUT" | egrep "^D.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[2]=$(echo "$UPDATEOUT" | egrep "^U.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[3]=$(echo "$UPDATEOUT" | egrep "^C.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[4]=$(echo "$UPDATEOUT" | egrep "^G.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + + # Define description of files considered recent modifications from + # central repository to working copy. + INFO[0]="`gettext "Added"`" + INFO[1]="`gettext "Deleted"`" + INFO[2]="`gettext "Updated"`" + INFO[3]="`gettext "Conflicted"`" + INFO[4]="`gettext "Merged"`" + + while [[ $COUNT -ne ${#FILES[*]} ]];do + + # Define total number of files. Avoid counting empty line. + if [[ "${FILES[$COUNT]}" == '' ]];then + FILESNUM[$COUNT]=0 + else + FILESNUM[$COUNT]=$(echo "${FILES[$COUNT]}" | wc -l) + fi + + # Calculate total amount of changes. + CHNGTOTAL=$(($CHNGTOTAL + ${FILESNUM[$COUNT]})) + + # Build report predicate. Use report predicate to show any + # information specific to the number of files found. For + # example, you can use this section to show warning messages, + # notes, and so on. By default we use the word `file' or + # `files' at ngettext's consideration followed by change + # direction. + PREDICATE[$COUNT]=`ngettext "file from the repository" \ + "files from the repository" $((${FILESNUM[$COUNT]} + 1))` + + # Output report line. + cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}" + + # Increase counter. + COUNT=$(($COUNT + 1)) + + done + +} diff --git a/Scripts/Bash/centos-art.sh b/Scripts/Bash/centos-art.sh new file mode 100755 index 0000000..e08aed7 --- /dev/null +++ b/Scripts/Bash/centos-art.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# +# centos-art.sh -- The CentOS Artwork Repository automation tool. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +# Initialize personal data. +declare -xr CLI_PROGRAM='centos-art' +declare -xr CLI_PROGRAM_ID=$$ +declare -xr CLI_VERSION='1.0 (beta)' + +# Initialize paths. +declare -xr CLI_WRKCOPY="${HOME}/artwork" +declare -xr CLI_BASEDIR="${CLI_WRKCOPY}/branches/Scripts/Bash" +declare -xr CLI_TEMPDIR='/tmp' + +# Initialize internazionalization through GNU gettext. +. gettext.sh +declare -xr TEXTDOMAIN=${CLI_PROGRAM}.sh +declare -xr TEXTDOMAINDIR=${CLI_WRKCOPY}/branches/L10n/Scripts/Bash + +# Verify the working copy directory. Be sure it is +# `/home/centos/artwork'. Otherwise, end the script execution. We +# cannot continue if the working copy is stored in a place other than +# `/home/centos/artwork'. This restriction is what let us to reuse +# contents using absolute paths inside a distributed environment like +# that one provided by The CentOS Artwork Repository. +if [[ ! -d ${CLI_WRKCOPY} ]];then + echo "`eval_gettext "The working copy must be under \\\"\\\$CLI_WRKCOPY\\\"."`" > /dev/stderr + exit +fi + +# Initialize common functions. +FILES=$(ls ${CLI_BASEDIR}/Functions/{cli,cli_*}.sh) +for FILE in ${FILES};do + if [[ -x ${FILE} ]];then + . ${FILE} + FUNCTION=$(grep '^function ' ${FILE} | cut -d' ' -f2) + export -f ${FUNCTION} + else + echo `eval_gettext "The \\\"\\\$FILE\\\" needs to have execution rights."` > /dev/stderr + exit + fi +done + +# Unset all variables not considered global in order to start common +# functions with a clean environment. +unset FILE +unset FILES +unset FUNCTION + +# Trap signals in order to terminate the script execution correctly +# (e.g., removing all temporal files before leaving). Trapping the +# exit signal seems to be enough by now, since it is always present as +# part of the script execution flow. Each time the centos-art.sh +# script is executed it will inevitably end with an EXIT signal at +# some point of its execution, even if it is interrupted in the middle +# of its execution (e.g., through `Ctrl+C'). +trap cli_terminateScriptExecution 0 + +# Initialize command-line interface. +cli "$@" diff --git a/Scripts/Php/Newbb2Phpbb/GPL b/Scripts/Php/Newbb2Phpbb/GPL new file mode 100755 index 0000000..5b6e7c6 --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/GPL @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Scripts/Php/Newbb2Phpbb/classes/db_mysql.php b/Scripts/Php/Newbb2Phpbb/classes/db_mysql.php new file mode 100755 index 0000000..60c9893 --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/classes/db_mysql.php @@ -0,0 +1,208 @@ + + ***/ + +class DB_MYSQL +{ + public $db_conn; + + public $db_host; + public $db_user; + public $db_pass; + public $db_xoops_db; + public $db_xoops_tbl; + public $db_phpbb_db; + public $db_phpbb_tbl; + + /*** + * Class Construct + ***/ + + function __construct() + { + // Initialize configuration values + $this->db_host = 'localhost'; + $this->db_user = 'root'; + $this->db_pass = ''; + $this->db_xoops_db = 'xoops'; + $this->db_xoops_tbl = 'xoops_'; + $this->db_phpbb_db = 'phpBB'; + $this->db_phpbb_tbl = 'phpbb_'; + + // Reinitialize configuration values + $config = array('db_host', 'db_user', 'db_pass', 'db_xoops_db', + 'db_xoops_tbl', 'db_phpbb_db', 'db_phpbb_tbl'); + + foreach ( $config as $param ) + { + if ( ! isset( $_SESSION[$param] ) ) + { + $_SESSION[$param] = $this->$param; + } + + $_SESSION[$param] = isset($_POST[$param])?$_POST[$param]:$_SESSION[$param]; + + $this->$param = $_SESSION[$param]; + } + } + + /*** + * Connect + */ + function connect() + { + // Connect to MySQL database + $this->db_conn = mysql_connect( $this->db_host, + $this->db_user, + $this->db_pass ); + if ( $this->db_conn ) + { + return true; + } + else + { + return false; + } + } + + /*** + * DB Configuration + */ + function get_configForm( $disabled = '' ) + { + $htmlblock = array(); + + array_push( $htmlblock, + // Common DB Configuration + '

Common DB configuration:

', + '
', + '
Server:
', + '
', + + '
Username:
', + '
', + + '
Password:
', + '
', + '
', + + // Xoops Configuration + '

Xoops configuration:

', + '
', + '
Xoops database name:
', + '
', + + '
Xoops table prefix:
', + '
', + + '
', + + // phpBB Configuration + '

phpBB configuration:

', + '
', + '
Phpbb database name:
', + '
', + + '
Phpbb table prefix:
', + '
', + '
'); + + return $htmlblock; + } + + /*** + * Query + */ + function query( $sql ) + { + $this->connect(); + $result = mysql_query( $sql, $this->db_conn ); + if ( $result ) + { + return $result; + } + else + { + return false; + } + } + + /*** + * Check existance + */ + function check_existance( $name ) + { + + switch ( $name ) + { + case 'phpbb': + $check_dbname = $this->db_phpbb_db; + $check_suffix = $this->db_phpbb_tbl; + $check_tables = array('users', 'forums', 'topics', 'posts'); + break; + + case 'xoops': + $check_dbname = $this->db_xoops_db; + $check_suffix = $this->db_xoops_tbl; + $check_tables = array('users', 'bb_forums', 'bb_topics', 'bb_posts', 'bb_posts_text'); + break; + } + + $error = 0; + $table_list = array(); + + // Check database existance + if ( ! mysql_select_db( $check_dbname ) ) + { + $error++; + } + + // Check tables existance + else + { + $sql = 'SHOW TABLES FROM ' . $check_dbname . ';'; + $result = $this->query( $sql ); + while ( $row = mysql_fetch_row ($result) ) + { + array_push($table_list, $row[0]); + } + + foreach ($check_tables as $tablename) + { + $tablename = $check_suffix . $tablename; + if (in_array($tablename, $table_list) === false ) + { + $error++; + } + } + } + + if ( $error == 0 ) + { + return true; + } + else + { + return false; + } + } + + /*** + * Class Destruct + ***/ + + function disconnect() + { + mysql_close( $this->db_conn ); + } +} + +$db = new DB_MYSQL; +?> diff --git a/Scripts/Php/Newbb2Phpbb/classes/html.php b/Scripts/Php/Newbb2Phpbb/classes/html.php new file mode 100755 index 0000000..6c85f07 --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/classes/html.php @@ -0,0 +1,132 @@ + '', + 1 => "\t", + 2 => "\t\t", + 3 => "\t\t\t", + 4 => "\t\t\t\t", + 5 => "\t\t\t\t\t"); + + // Define indententaion level by tags + $levels = array('/<\/?html/' => 0, + '/<\/?(body|head)( .+|>)/' => 1, + '/<\/?(title)( .+|>)/' => 2, + '/<\/?(br|hr) \/>/' => 2, + '/<\/?(p|pre|table|dl|ul|ol|div|h[1-9]|form|link)( .+|>)/' => 3, + '/<\/?(li|dt|dd|span|select|option|tr)( .+|>)/' => 4, + '/<\/?(th|td)( .+|>)/' => 5); + + // Set line level, line by line + foreach ( $htmlblock as $line ) + { + foreach ( $levels as $tag => $level ) + { + if ( preg_match( $tag, $line ) ) + { + $html_formatted .= $tabs[$level] . $line . "\n"; + } + + } + } + + return $html_formatted; + } + + /*** + * Format messages + * + * $message : the message text itself. + * $color : grey|green|orange|blue|violet|red + * if no color is specified grey color is assumed as default + */ + function format_message( $message = 'Empty', $color = '' ) + { + // Validate color to be used + $valid_colors = array('grey', 'green', 'orange', 'violet', 'blue', 'red'); + if ( ! in_array( $color, $valid_colors ) ) + { + $color = ''; + } + + // Build message html + $html = '
' . strtoupper($message) . '
'; + + return $html; + } + + /*** + * Where is my position in the migration ? + * ---------------------------------------------------- + * It is somehow a breadcrumb of where you are in the migration process. + */ + function get_stepPosition() + { + // Define migration process stepts + $steps = array(0 => 'Configuration', + 1 => 'Verification', + 2 => 'Migration', + 3 => 'Reset Passwords'); + + $position = isset( $_POST['step'] )?$_POST['step']:0; + + $htmlblock = array(''); + + return $htmlblock; + } + + /*** + * Navibar + */ + function get_navibar() + { + global $db; + + $htmlblock = array(''); + + return $htmlblock; + } +} + +$html = new HTML; +?> diff --git a/Scripts/Php/Newbb2Phpbb/classes/ldap.php b/Scripts/Php/Newbb2Phpbb/classes/ldap.php new file mode 100755 index 0000000..63d78b0 --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/classes/ldap.php @@ -0,0 +1,321 @@ + + ***/ + +class LDAP +{ + public $this_conn; + public $this_host; + public $this_port; + public $this_rootdn; + public $this_rootpw; + public $this_authschema; + public $this_basedn; + + /*** + * Class initialization + */ + function __construct() + { + // Initialize configuration values + $this->ldap_host = 'localhost'; + $this->ldap_port = '389'; + $this->ldap_rootdn = 'cn=manager,dc=example,dc=com'; + $this->ldap_rootpw = ''; + $this->ldap_authschema = '{MD5}'; + $this->ldap_basedn = 'ou=people,dc=example,dc=com'; + + // Reinitialize configuration values + $config = array('ldap_host', 'ldap_port', 'ldap_rootdn', + 'ldap_rootpw', 'ldap_authschema','ldap_basedn'); + + foreach ( $config as $param ) + { + if ( ! isset($_SESSION[$param] ) ) + { + $_SESSION[$param] = $this->$param; + } + + $_SESSION[$param] = isset($_POST[$param])?$_POST[$param]:$_SESSION[$param]; + + $this->$param = $_SESSION[$param]; + } + + // Open connection against ldap server + if ( $this->ldap_host && $this->ldap_port ) + { + $this->ldap_conn = ldap_connect( $this->ldap_host, $this->ldap_port ); + } + + // Set protocol version to use LDAPv3 + ldap_set_option( $this->ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); + } + + /*** + * LDAP configuration + */ + function get_configForm( $disabled = "" ) + { + $htmlblock = array(); + + array_push( $htmlblock, + + '

LDAP configuration:

', '
', + + '
Host:
', + '
', + + '
Port:
', + '
', + + '
Bind DN:
', + '
', + + '
Base DN:
', + '
', + + '
Bind Password:
', + '
', + + + '
Schema:
', + '
', + '', + '
', + + '
'); + + return $htmlblock; + } + + + /*** + * Verify configuration + */ + function verify_configuration() + { + + } + + /*** + * Bind to LDAP server + */ + function do_bind() + { + return ldap_bind( $this->ldap_conn, $this->ldap_rootdn, $this->ldap_rootpw ); + } + + /*** + * Verify LDAP uid's value uniqness + */ + function is_uid_present( $uid ) + { + $filter = 'uid=' . $uid; + $result = ldap_search( $this->ldap_conn, $this->ldap_basedn, $filter); + $entry = ldap_get_entries( $this->ldap_conn, $result); + + if ( $uid != '' && $entry['count'] == 1 ) + { + return true; + } + else + { + return false; + } + } + + /*** + * Prepare LDAP userPassword attribute + */ + function prepare_userpassword( $userpassword ) + { + $dirty['userpassword'] = $userpassword; + $clean['userpassword'] = ''; + + switch ( $this->ldap_authschema ) + { + case '{MD5}': + $clean['userpassword'] = '{MD5}' . base64_encode( pack( 'H*', md5( $dirty['userpassword'] ) ) ); + break; + + case '{SHA}': + $clean['userpassword'] = '{SHA}' . base64_encode( pack( 'H*', sha1( $dirty['userpassword'] ) ) ); + break; + } + + return $clean['userpassword']; + } + + + /*** + * Add User + */ + function add_User( $entry ) + { + $this_entry = array(); + + // Define user DN + $dn = 'uid=' . $entry['email'] . ',' . $this->ldap_basedn; + + // Remove user if exists + if ( $this->is_uid_present( $entry['uname'] ) === true ) + { + $this->delete_User( $entry ); + } + + // Prepare userPassword and other attributes for insertion in LDAP directory. + $this_entry['objectclass'] = 'inetOrgPerson'; + $this_entry['cn'] = $entry['name']; + $this_entry['mail'] = $entry['email']; + $this_entry['userpassword'] = $this->prepare_userpassword($entry['pass']); + $this_entry['sn'] = preg_replace('/^([a-zA-Z0-9_]+ ?)/','', $this_entry['cn']); + $this_entry['uid'][0] = $this_entry['mail']; + $this_entry['uid'][1] = $entry['uname']; + $this_entry['displayname'] = $entry['uname']; + $this_entry['employeetype'] = 'writer'; + $this_entry['preferredlanguage'] = 'en'; + + if ( $this->do_bind() && ldap_add( $this->ldap_conn, $dn, $this_entry )) + { + return true; + } + else + { + return false; + } + } + + /*** + * Delete User + */ + function delete_User( $entry ) + { + // Define user DN + $dn = 'uid=' . $entry['email'] . ',' . $this->ldap_basedn; + + if ( $this->do_bind() && ldap_delete( $this->ldap_conn, $dn ) ) + { + return true; + } + else + { + return false; + } + } + + /*** + * Update LDAP userPassword only. + */ + function update_userPassword( $dn, $userPassword ) + { + $entry = array('userpassword' => $userPassword ); + + if ( $this->do_bind() && ldap_modify( $this->ldap_conn, $dn, $entry) ) + { + return true; + } + else + { + return false; + } + } + + /*** + * Get LDAP user list + * ---------------------------------------------------- + * 1. Show a form with a list of all users inserted from xoops.users table. + * 2. Generate random passwords for each user and codify them into + * userPassword format. + * 3. Real passwords are not displayed. + */ + function get_userList() + { + global $newbb_to_phpbb; + global $mail; + + // Get users from LDAP server + $filter = 'objectclass=inetorgperson'; + $result = ldap_search( $this->ldap_conn, $this->ldap_basedn, $filter); + $users = ldap_get_entries( $this->ldap_conn, $result ); + + $htmlblock = array('

'.$users['count'].' password(s) reset under: '.$this->ldap_basedn.'

', + '', + '', + '', + '', + '', + '', + '', + '', + ''); + + for ($i = 0; $i < $users['count']; $i++) + { + // Reset userPassword value in a random manner + $newPassword = $newbb_to_phpbb->get_randomPass(); + $userPassword = $this->prepare_userpassword($newPassword); + + array_push($htmlblock, '', + '', + '', + '', + ''); + + // Update LDAP userPassword field + if ( $this->update_userPassword( $users[$i]['dn'], $userPassword ) === true ) + { + array_push($htmlblock,''); + } + else + { + array_push($htmlblock,''); + } + + // Send email notification + $info = array('mailto' => $users[$i]['mail'][0], + 'cn' => $users[$i]['cn'][0], + 'dn' => $users[$i]['dn'], + 'uid1' => $users[$i]['uid'][0], + 'uid2' => $users[$i]['uid'][1], + 'sn' => $users[$i]['sn'][0], + 'employeetype' => $users[$i]['employeetype'][0], + 'preferredlanguage' => $users[$i]['preferredlanguage'][0], + 'displayname' => $users[$i]['displayname'][0], + 'userpassword' => $newPassword); + if ( $mail->send( $info ) === true ) + { + array_push($htmlblock,''); + } + else + { + array_push($htmlblock,''); + } + array_push($htmlblock,''); + } + + array_push($htmlblock,'
DNCNNewPassuserPasswordPassword UpdatedEmail Notification
' . $users[$i]['dn'] . '' . $users[$i]['cn'][0] . '' . $newPassword . '' . $userPassword . 'YESNOSENTNOT SENT
'); + + return $htmlblock; + } + + /*** + * Class destruct + */ + function __destruct() + { + if ( isset( $this->ldap_conn ) ) + { + ldap_unbind( $this->ldap_conn ); + } + } +} + +$ldap = new LDAP; +?> diff --git a/Scripts/Php/Newbb2Phpbb/classes/mail.php b/Scripts/Php/Newbb2Phpbb/classes/mail.php new file mode 100755 index 0000000..ead6bfc --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/classes/mail.php @@ -0,0 +1,157 @@ +notification = 'NO'; + $this->notification_subject = '[CentOS Forum] User account notification.'; + $this->notification_message = "Dear =USER_FIRST_NAME=, + +The CentOS Forums (http://centos.org/forums/) were migrated from +Xoops+CBB(newbb) to phpBB3 and the user accounts were moved to an LDAP +server. As consequence your user account is now on that LDAP server. + +In order to make this happen, it was needed to reset your account +password. Your password(userPassword) is here with the rest of your +user account information. + +The following LDAP entry has the information of your user account: + + dn: =DN= + uid: =UID1= + uid: =UID2= + userPassword: =PASS= + mail: =MAIL= + cn: =CN= + sn: =SN= + employeeType: =TYPE= +preferredLanguage: =LANG= + displayName: =DISPLAYNAME= + +With this migration we are preparing the ground to unify all CentOS +user accounts into a common place. If you need to authenticate +somewhere under centos.org domain use any of your uids and the +password provided above. + +Best Regards, +-- +The CentOS Team"; + + // Reinitialize variables with form values + $config = array('notification', 'notification_subject', 'notification_message'); + foreach ( $config as $param ) + { + if ( ! isset($_SESSION[$param])) + { + $_SESSION[$param] = $this->$param; + } + + $_SESSION[$param] = isset($_POST[$param])?$_POST[$param]:$_SESSION[$param]; + + $this->$param = $_SESSION[$param]; + } + } + + /*** + * Send + * ------- + * $info is an array with the following indexes: + * - mailto + * - name + * - dn + * - newpass + */ + + function send( $info ) + { + // Do replacements in message template + $this->notification_message = preg_replace('/=MAIL=/', $info['mailto'],$this->notification_message); + $this->notification_message = preg_replace('/=DN=/', $info['dn'],$this->notification_message); + $this->notification_message = preg_replace('/=UID1=/', $info['uid1'],$this->notification_message); + $this->notification_message = preg_replace('/=UID2=/', $info['uid2'],$this->notification_message); + $this->notification_message = preg_replace('/=PASS=/', $info['userpassword'],$this->notification_message); + $this->notification_message = preg_replace('/=CN=/', $info['cn'],$this->notification_message); + $this->notification_message = preg_replace('/=SN=/', $info['sn'],$this->notification_message); + $this->notification_message = preg_replace('/=TYPE=/', $info['employeetype'],$this->notification_message); + $this->notification_message = preg_replace('/=LANG=/', $info['preferredlanguage'],$this->notification_message); + $this->notification_message = preg_replace('/=DISPLAYNAME=/',$info['displayname'],$this->notification_message); + $this->notification_message = preg_replace('/=USER_FIRST_NAME=/', preg_replace('/ .+$/','',$info['cn']), $this->notification_message); + + $to = $info['mailto']; + $subject = $this->notification_subject; + $message = $this->notification_message; + $headers = 'From: webmaster'; + $extra_params = '-fwebmaster'; + if ( $this->notification == 'YES' ) + { + return mail( $to, $subject, $message, $headers, $extra_params ); + } + } + + /*** + * Send notification ? + * Show form selector + */ + + function get_configForm( $disabled = '' ) + { + $htmlblock = array('

Mail Notification:

','
'); + + // Mail template + array_push($htmlblock, + + '
Subject:
', + '
', + + '
Message:
', + '
', + + '
Send notifications ?:
', + '
Use it with care!
'); + + array_push($htmlblock, '
'); + + return $htmlblock; + } + + /*** + * Class destructor + */ + + function __destruct() + { + + } +} + +$mail = new MAIL; +?> diff --git a/Scripts/Php/Newbb2Phpbb/classes/newbb_to_phpbb.php b/Scripts/Php/Newbb2Phpbb/classes/newbb_to_phpbb.php new file mode 100755 index 0000000..2eb5e64 --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/classes/newbb_to_phpbb.php @@ -0,0 +1,424 @@ + + ***/ + + +class NEWBB_TO_PHPBB +{ + + /*** + * Class Construct + * ---------------------------------------------------- + */ + function __construct() + { + // Initialize session + session_start(); + + // Check action: usedefaults + if ( isset( $_GET['action'] ) && $_GET['action'] == 'restore' ) + { + // Unset session values + session_unset(); + + // Reload page + header('Location: index.php'); + } + } + + /*** + * Verify Configuration + * + * This verification is needed to be sure new information entered + * is valid. + */ + function config_verification( $next_step ) + { + global $db; + global $ldap; + global $html; + + $htmlblock = array(); + $error = 0; + + // Verify LDAP bind + if ( $ldap->do_bind() ) + { + array_push($htmlblock, $html->format_message('LDAP Configuration is correct', 'green')); + } + else + { + array_push( $htmlblock, $html->format_message('LDAP Configuration is incorrect', 'orange')); + $error++; + } + + // Verify Database + if ( $db->connect() === true ) + { + array_push( $htmlblock, $html->format_message('Common DB Configuration is correct', 'green')); + + // Verify XOOPS database and table + if ( $db->check_existance('xoops') === true ) + { + array_push( $htmlblock, $html->format_message('Xoops configuration is correct', 'green')); + } + else + { + array_push( $htmlblock, $html->format_message('Xoops configuration is incorrect', 'orange')); + $error++; + } + + // Verify PHPBB database and table + if ( $db->check_existance('phpbb') === true ) + { + array_push( $htmlblock, $html->format_message('phpBB configuration is correct', 'green')); + } + else + { + array_push( $htmlblock, $html->format_message('phpBB configuration is incorrect', 'orange')); + $error++; + } + } + else + { + array_push( $htmlblock, $html->format_message('Common DB Configuration is incorrect', 'orange')); + $error++; + } + + // Add action button + if ( $error == 0 ) + { + $next_step++; + array_push( $htmlblock, + '

+ + +

'); + } + else + { + array_push($htmlblock, '

PreviousCheck your configuration

'); + } + + return $html->format_htmlblock($htmlblock); + } + + /*** + * Groups + * + * All users in xoops.users will be inserted into phpBB.users + * using the REGISTERED group (group_id = 2). Forums administrators should + * be redifined after migration. + */ + + /*** + * Users + * + * Basic fields are copied from xoops.users to phpBB.users. + * + * Password field should be redifined by the user in order to get logged in + * after the migration. + * + * If LDAP authentication is used the directory structure should be design + * to receive uid and userPassword attributes. In this case the migration + * should be focused from xoops.users to LDAP directory not phpBB.users. + * + * The LDAP registration process is (as my understanding): 1. Add an entry + * for the user in the LDAP directory. 2. Add an entry for the user in the + * DB (this is automatically done by phpBB). This is needed to relate user + * against user specific information like topics, posts, etc. + * + * As we are using LDAP server for users. This function use php's ldap + * extension to add users into LDAP directory. If the user do no exist in + * the Database but in LDAP server, phpBB will automatically insert a + * record for that user in the phpBB.user table. It is needed to relate + * user identity to posts, topics, etc . + * + * User passwords need to be reseted and a notification could be send to each + * user telling the new password set. This is requiered because the + * password codification used in newbb, phpbb and LDAP is different. + * + * The structure of LDAP user entries was built with rfc2377 in mind. + */ + function copy_Users() + { + global $ldap; + global $db; + + $htmlblock = array('

Users

','
    '); + + // Remove phpBB.users. Number 52 seems to be the greatest user_id + // value when no user has been created. + + array_push($htmlblock,'
  • Cleanning up ...
  • '); + + $sql = sprintf('DELETE FROM %s.%susers WHERE user_id > 52;', + $db->db_phpbb_db, + $db->db_phpbb_tbl ); + $db->query( $sql ); + + // Add users into LDAP directory + + array_push($htmlblock,'
  • Copying ...
  • '); + + $sql = sprintf("SELECT uname, + name, + email, + pass + FROM %s.%susers WHERE uid > 1", + $db->db_xoops_db, + $db->db_xoops_tbl ); + + $result = $db->query( $sql ); + + $counter = 0; + + while ( $entry = mysql_fetch_array( $result ) ) + { + // Add xoops.users into LDAP directory + if ( $ldap->add_User( $entry ) === true ) + { + $counter++; + } + } + + array_push($htmlblock,'
  • '. $counter .' user(s) copied successfully.
  • ','
'); + + return $htmlblock; + } + + /*** + * Categories + * + * Not copied. In phpBB there is no category. + */ + + /*** + * Copy Forum + */ + function copy_Forums() + { + global $db; + + $htmlblock = array('

Forums

', '
    '); + + // Clean up Forums + + array_push( $htmlblock, '
  • Cleanning up ...
  • ' ); + + $sql = sprintf("TRUNCATE %s.%sforums;", + $db->db_phpbb_db, + $db->db_phpbb_tbl ); + + $db->query( $sql ); + + // Copy Forums + + array_push($htmlblock,'
  • Copying ...
  • '); + + $sql = sprintf("INSERT INTO %s.%sforums (forum_name, + forum_desc, + forum_topics, + forum_topics_real, + forum_type, + forum_posts) SELECT forum_name, + forum_desc, + forum_topics, + forum_topics, + (SELECT 1 AS forum_type), + forum_posts FROM %s.%sbb_forums;", + $db->db_phpbb_db, $db->db_phpbb_tbl, + $db->db_xoops_db, $db->db_xoops_tbl); + + $db->query( $sql ); + + // Get forums recently added and update their order, ownership, and type. + + $sql = sprintf('SELECT forum_id, left_id, right_id FROM %s.%sforums;', + $db->db_phpbb_db, + $db->db_phpbb_tbl ); + + $result = $db->query( $sql ); + + // Sanitize forum's order one by one + + $left_id = 1; + $right_id = 2; + $counter = 0; + + while ( $row = mysql_fetch_array( $result ) ) + { + $sql = sprintf("UPDATE %s.%sforums SET left_id = %d, right_id = %d WHERE forum_id = %d;", + $db->db_phpbb_db, + $db->db_phpbb_tbl, + $left_id, + $right_id, + $row['forum_id']); + + $db->query( $sql ); + + $left_id = $left_id + 2; + $right_id = $left_id + 1; + + // Counter + + $counter++; + } + + // Get amount of forums copied. + array_push( $htmlblock, '
  • ' . $counter . ' forum(s) copied successfully.
  • ', '
'); + + return $htmlblock; + } + + /*** + * Topics + * + * When doing Topic copying the user used will be administrator. This means + * that all topics and posts after migration will be own by the + * administrator user. + */ + function copy_Topics() + { + global $db; + + $htmlblock = array('

Topics

','
    '); + + // Claen up topics + + array_push( $htmlblock, '
  • Cleanning up ...
  • ' ); + + $sql = sprintf("TRUNCATE %s.%stopics;", + $db->db_phpbb_db, + $db->db_phpbb_tbl ); + + $db->query( $sql ); + + // Copy topics + + array_push( $htmlblock, '
  • Copying ...
  • ' ); + + $sql = sprintf("INSERT INTO %s.%stopics (forum_id, + topic_title, + topic_time, + topic_last_post_time, + topic_views, + topic_last_poster_id, + topic_poster, + topic_replies, + topic_replies_real) SELECT forum_id, + topic_title, + topic_time, + topic_time, + topic_views, + (SELECT 2 AS last_poster_id), + (SELECT 2 AS last_poster_id), + topic_replies, + topic_replies + FROM %s.%sbb_topics", + $db->db_phpbb_db, $db->db_phpbb_tbl, + $db->db_xoops_db, $db->db_xoops_tbl ); + + $db->query( $sql ); + + array_push( $htmlblock, '
  • ' . mysql_affected_rows() . ' topic(s) copied successfully.
  • ', '
' ); + + return $htmlblock; + } + + /*** + * Posts + */ + function copy_Posts() + { + global $db; + + $htmlblock = array('

Posts

','
    '); + + // Clean Up posts + + array_push($htmlblock,'
  • Cleanning up ...
  • '); + + $sql = sprintf("TRUNCATE %s.%sposts;", $db->db_phpbb_db, $db->db_phpbb_tbl); + + $db->query( $sql ); + + // Copy Posts + + array_push( $htmlblock, '
  • Copying ...
  • '); + + $sql = sprintf("INSERT INTO %s.%sposts (topic_id, + forum_id, + poster_id, + post_time, + post_subject, + post_text) SELECT t1.topic_id, + t1.forum_id, + (SELECT 2 AS poster_id), + t1.post_time, + t1.subject, + t2.post_text + FROM %s.%sbb_posts t1 + LEFT JOIN %s.%sbb_posts_text t2 + ON t2.post_id = t1.post_id;", + $db->db_phpbb_db, $db->db_phpbb_tbl, + $db->db_xoops_db, $db->db_xoops_tbl, + $db->db_xoops_db, $db->db_xoops_tbl); + + $db->query( $sql ); + + array_push( $htmlblock, '
  • ' . mysql_affected_rows() .' posts(s) copied successfully.
  • ', '
'); + + return $htmlblock; + } + + /*** + * Generate random password + */ + function get_randomPass() + { + // Add lower case letters + $seed = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'i', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', + 'y', 'z'); + + // Add upper case letters + foreach ( $seed as $value ) + { + array_push( $seed, strtoupper($value) ); + } + + // Add numbers + array_push( $seed, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' ); + + // Use some symbols chars + array_push( $seed, '!', '@', '#', '$', '%', '=', '/','+' ); + + // Build password based on seed + $userPassword = ''; + $passwordLength = 20; + for ($i = 0; $i < $passwordLength; $i++) + { + $userPassword = $userPassword . $seed[array_rand($seed)]; + } + + return $userPassword; + } + + /*** + * Class Destruct + * ---------------------------------------------------- + */ + + function __destruct() + { + } +} + +$newbb_to_phpbb = new NEWBB_TO_PHPBB; +?> diff --git a/Scripts/Php/Newbb2Phpbb/contents/content.php b/Scripts/Php/Newbb2Phpbb/contents/content.php new file mode 100755 index 0000000..b1cbb49 --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/contents/content.php @@ -0,0 +1,17 @@ + diff --git a/Scripts/Php/Newbb2Phpbb/contents/footer.php b/Scripts/Php/Newbb2Phpbb/contents/footer.php new file mode 100755 index 0000000..0c54f0d --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/contents/footer.php @@ -0,0 +1,6 @@ +', + '', + '', + ''); +?> diff --git a/Scripts/Php/Newbb2Phpbb/contents/header.php b/Scripts/Php/Newbb2Phpbb/contents/header.php new file mode 100755 index 0000000..9b9851d --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/contents/header.php @@ -0,0 +1,27 @@ + +', + '', + '', + 'newbb to phpbb :: Migrating Xoops+CBB(newbb) to phpBB', + '', + '', + '', + ''); + + // Where am I in the migration process ? + if ( ! isset($_GET['p'] ) ) + { + $htmlblock = array_merge($htmlblock, $html->get_stepPosition()); + } + + array_push($htmlblock,'
'); +?> diff --git a/Scripts/Php/Newbb2Phpbb/contents/p_help.php b/Scripts/Php/Newbb2Phpbb/contents/p_help.php new file mode 100755 index 0000000..111af2e --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/contents/p_help.php @@ -0,0 +1,36 @@ + + newbb to phpbb :: Migrating from Xoops+CBB(newbb) to phpBB+LDAP + Copyright (C) 2009 Alain Reguera Delgado + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +"; + +array_push($htmlblock,'

Help

', '
', + '

About

', + '

newbb to phpbb do two things mainly:

', + '
    ', + '
  1. Migrate users from Xoops to LDAP.
  2. ', + '
  3. Migrate Forums, Topics, and Posts from Xoops\' CBB module (a.k.a newbb) to phpBB3.
  4. ', + '
', + '

Documentation works are in the project\'s page.

', + '

Authors

', + '', + '

Lisence

', + $lisence); diff --git a/Scripts/Php/Newbb2Phpbb/contents/p_main.php b/Scripts/Php/Newbb2Phpbb/contents/p_main.php new file mode 100755 index 0000000..75f66c9 --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/contents/p_main.php @@ -0,0 +1,59 @@ +'); + // Configuration + if ( $next_step == 0 ) + { + $next_step++; + array_push($htmlblock,'

Configuration

', '
'); + $htmlblock = array_merge($htmlblock,$ldap->get_configForm()); + $htmlblock = array_merge($htmlblock,$db->get_configForm()); + $htmlblock = array_merge($htmlblock,$mail->get_configForm()); + + array_push($htmlblock, '

', + 'ReloadReload default configuration + ', + '', + '

'); + } + + // Verification + else if ( $next_step == 1 ) + { + array_push($htmlblock,'

Verification

', + '
', + $newbb_to_phpbb->config_verification( $next_step )); + } + + // Migration + else if ( $next_step == 2 ) + { + array_push($htmlblock,'

Migration

', '
'); + $htmlblock = array_merge($htmlblock, $newbb_to_phpbb->copy_Forums(), + $newbb_to_phpbb->copy_Users(), + $newbb_to_phpbb->copy_Topics(), + $newbb_to_phpbb->copy_Posts()); + $next_step++; + array_push($htmlblock,'

+ + +

'); + } + + // Reset Passwords + else if ( $next_step == 3 ) + { + $next_step++; + array_push($htmlblock,'

Reset Passwords

', '
'); + $htmlblock = array_merge($htmlblock, $ldap->get_userList()); + array_push($htmlblock,'

That\'s all! smile

'); + } + + array_push($htmlblock,''); + +?> diff --git a/Scripts/Php/Newbb2Phpbb/img/header-bg.png b/Scripts/Php/Newbb2Phpbb/img/header-bg.png new file mode 100755 index 0000000..ff2a7b0 Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/header-bg.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/html-bg.png b/Scripts/Php/Newbb2Phpbb/img/html-bg.png new file mode 100755 index 0000000..30f7d70 Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/html-bg.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-blue.png b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-blue.png new file mode 100755 index 0000000..7a816cf Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-blue.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-gray.png b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-gray.png new file mode 100755 index 0000000..43d1a55 Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-gray.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-green.png b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-green.png new file mode 100755 index 0000000..f4ca7ca Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-green.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-orange.png b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-orange.png new file mode 100755 index 0000000..25a57b5 Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-orange.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-red.png b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-red.png new file mode 100755 index 0000000..2dfcf09 Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-red.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-violet.png b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-violet.png new file mode 100755 index 0000000..657824d Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/moin-msg-bg-violet.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/navibartop-bg.png b/Scripts/Php/Newbb2Phpbb/img/navibartop-bg.png new file mode 100755 index 0000000..936da33 Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/navibartop-bg.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/navibartop-hover-bg.png b/Scripts/Php/Newbb2Phpbb/img/navibartop-hover-bg.png new file mode 100755 index 0000000..1d5596e Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/navibartop-hover-bg.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/previous.png b/Scripts/Php/Newbb2Phpbb/img/previous.png new file mode 100644 index 0000000..d3bc514 Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/previous.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/reload.png b/Scripts/Php/Newbb2Phpbb/img/reload.png new file mode 100644 index 0000000..e46da27 Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/reload.png differ diff --git a/Scripts/Php/Newbb2Phpbb/img/smile.png b/Scripts/Php/Newbb2Phpbb/img/smile.png new file mode 100755 index 0000000..44cc239 Binary files /dev/null and b/Scripts/Php/Newbb2Phpbb/img/smile.png differ diff --git a/Scripts/Php/Newbb2Phpbb/index.php b/Scripts/Php/Newbb2Phpbb/index.php new file mode 100755 index 0000000..58d93dc --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/index.php @@ -0,0 +1,13 @@ +format_htmlblock( $htmlblock ); +?> diff --git a/Scripts/Php/Newbb2Phpbb/schemas/newbb-mysql.sql b/Scripts/Php/Newbb2Phpbb/schemas/newbb-mysql.sql new file mode 100755 index 0000000..a3f14f6 --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/schemas/newbb-mysql.sql @@ -0,0 +1,311 @@ +-- phpMyAdmin SQL Dump +-- version 2.6.4-pl4 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: May 07, 2006 at 01:26 PM +-- Server version: 5.0.16 +-- PHP Version: 5.1.0 +-- +-- CBB 3.04 +-- +-- +-- Database: `cbb` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_archive` +-- + +CREATE TABLE `bb_archive` ( + `topic_id` int(8) unsigned NOT NULL default '0', + `post_id` int(10) unsigned NOT NULL default '0', + `post_text` text NOT NULL +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_attachments` +-- + +CREATE TABLE `bb_attachments` ( + `attach_id` int(8) unsigned NOT NULL auto_increment, + `post_id` int(10) unsigned NOT NULL default '0', + `name_saved` varchar(255) NOT NULL default '', + `name_disp` varchar(255) NOT NULL default '', + `mimetype` varchar(255) NOT NULL default '', + `online` tinyint(1) unsigned NOT NULL default '1', + `attach_time` int(10) unsigned NOT NULL default '0', + `download` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`attach_id`), + KEY `post_id` (`post_id`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_categories` +-- + +CREATE TABLE `bb_categories` ( + `cat_id` smallint(3) unsigned NOT NULL auto_increment, + `cat_image` varchar(50) NOT NULL default '', + `cat_title` varchar(100) NOT NULL default '', + `cat_description` text NOT NULL, + `cat_order` smallint(3) unsigned NOT NULL default '0', + `cat_url` varchar(255) NOT NULL default '', + PRIMARY KEY (`cat_id`), + KEY `cat_order` (`cat_order`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_digest` +-- + +CREATE TABLE `bb_digest` ( + `digest_id` int(8) unsigned NOT NULL auto_increment, + `digest_time` int(10) unsigned NOT NULL default '0', + `digest_content` text, + PRIMARY KEY (`digest_id`), + KEY `digest_time` (`digest_time`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_forums` +-- + +CREATE TABLE `bb_forums` ( + `forum_id` smallint(4) unsigned NOT NULL auto_increment, + `forum_name` varchar(150) NOT NULL default '', + `forum_desc` text, + `parent_forum` smallint(4) unsigned NOT NULL default '0', + `forum_moderator` varchar(255) NOT NULL default '', + `forum_topics` int(8) unsigned NOT NULL default '0', + `forum_posts` int(10) unsigned NOT NULL default '0', + `forum_last_post_id` int(10) unsigned NOT NULL default '0', + `cat_id` smallint(3) unsigned NOT NULL default '0', + `forum_type` tinyint(1) unsigned NOT NULL default '0', + `allow_html` tinyint(1) unsigned NOT NULL default '1', + `allow_sig` tinyint(1) unsigned NOT NULL default '1', + `allow_subject_prefix` tinyint(1) unsigned NOT NULL default '0', + `hot_threshold` tinyint(3) unsigned NOT NULL default '10', + `forum_order` smallint(4) unsigned NOT NULL default '0', +# `allow_attachments` tinyint(1) unsigned NOT NULL default '1', + `attach_maxkb` smallint(3) unsigned NOT NULL default '1000', + `attach_ext` varchar(255) NOT NULL default '', + `allow_polls` tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (`forum_id`), + KEY `forum_last_post_id` (`forum_last_post_id`), + KEY `cat_forum` (`cat_id`,`forum_order`), + KEY `forum_order` (`forum_order`), + KEY `cat_id` (`cat_id`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_moderates` +-- + +CREATE TABLE `bb_moderates` ( + `mod_id` int(10) unsigned NOT NULL auto_increment, + `mod_start` int(10) unsigned NOT NULL default '0', + `mod_end` int(10) unsigned NOT NULL default '0', + `mod_desc` varchar(255) NOT NULL default '', + `uid` int(10) unsigned NOT NULL default '0', + `ip` varchar(32) NOT NULL default '', + `forum_id` smallint(4) unsigned NOT NULL default '0', + PRIMARY KEY (`mod_id`), + KEY `uid` (`uid`), + KEY `mod_end` (`mod_end`), + KEY `forum_id` (`forum_id`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_online` +-- + +CREATE TABLE `bb_online` ( + `online_forum` int(10) unsigned NOT NULL default '0', + `online_topic` int(8) unsigned NOT NULL default '0', + `online_uid` int(10) unsigned NOT NULL default '0', + `online_uname` varchar(255) NOT NULL default '', + `online_ip` varchar(32) NOT NULL default '', + `online_updated` int(10) unsigned NOT NULL default '0', + KEY `online_forum` (`online_forum`), + KEY `online_topic` (`online_topic`), + KEY `online_updated` (`online_updated`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_posts` +-- + +CREATE TABLE `bb_posts` ( + `post_id` int(10) unsigned NOT NULL auto_increment, + `pid` int(10) unsigned NOT NULL default '0', + `topic_id` int(8) unsigned NOT NULL default '0', + `forum_id` smallint(4) unsigned NOT NULL default '0', + `post_time` int(10) unsigned NOT NULL default '0', + `uid` int(10) unsigned NOT NULL default '0', + `poster_name` varchar(255) NOT NULL default '', + `poster_ip` int(11) NOT NULL default '0', + `subject` varchar(255) NOT NULL default '', + `dohtml` tinyint(1) unsigned NOT NULL default '0', + `dosmiley` tinyint(1) unsigned NOT NULL default '1', + `doxcode` tinyint(1) unsigned NOT NULL default '1', + `dobr` tinyint(1) unsigned NOT NULL default '1', + `doimage` tinyint(1) unsigned NOT NULL default '1', + `icon` varchar(25) NOT NULL default '', + `attachsig` tinyint(1) unsigned NOT NULL default '0', + `approved` smallint(2) NOT NULL default '1', + `post_karma` int(10) unsigned NOT NULL default '0', + `attachment` text, + `require_reply` tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (`post_id`), + KEY `uid` (`uid`), + KEY `pid` (`pid`), + KEY `forum_id` (`forum_id`), + KEY `topic_id` (`topic_id`), + KEY `subject` (`subject`(40)), + KEY `forumid_uid` (`forum_id`,`uid`), + KEY `topicid_uid` (`topic_id`,`uid`), + KEY `post_time` (`post_time`), + KEY `topicid_postid_pid` (`topic_id`,`post_id`,`pid`), + FULLTEXT KEY `search` (`subject`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_posts_text` +-- + +CREATE TABLE `bb_posts_text` ( + `post_id` int(10) unsigned NOT NULL default '0', + `post_text` text, + `post_edit` text, + PRIMARY KEY (`post_id`), + FULLTEXT KEY `search` (`post_text`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_reads_forum` +-- + +CREATE TABLE `bb_reads_forum` ( + `read_id` int(10) unsigned NOT NULL auto_increment, + `uid` int(10) unsigned NOT NULL default '0', + `read_time` int(10) unsigned NOT NULL default '0', + `read_item` smallint(4) unsigned NOT NULL default '0', + `post_id` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`read_id`), + KEY `uid` (`uid`), + KEY `read_item` (`read_item`), + KEY `post_id` (`post_id`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_reads_topic` +-- + +CREATE TABLE `bb_reads_topic` ( + `read_id` int(10) unsigned NOT NULL auto_increment, + `uid` int(10) unsigned NOT NULL default '0', + `read_time` int(10) unsigned NOT NULL default '0', + `read_item` int(8) unsigned NOT NULL default '0', + `post_id` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`read_id`), + KEY `uid` (`uid`), + KEY `read_item` (`read_item`), + KEY `post_id` (`post_id`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_report` +-- + +CREATE TABLE `bb_report` ( + `report_id` int(8) unsigned NOT NULL auto_increment, + `post_id` int(10) unsigned NOT NULL default '0', + `reporter_uid` int(10) unsigned NOT NULL default '0', + `reporter_ip` int(11) NOT NULL default '0', + `report_time` int(10) unsigned NOT NULL default '0', + `report_text` varchar(255) NOT NULL default '', + `report_result` tinyint(1) unsigned NOT NULL default '0', + `report_memo` varchar(255) NOT NULL default '', + PRIMARY KEY (`report_id`), + KEY `post_id` (`post_id`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_topics` +-- + +CREATE TABLE `bb_topics` ( + `topic_id` int(8) unsigned NOT NULL auto_increment, + `topic_title` varchar(255) NOT NULL default '', + `topic_poster` int(10) unsigned NOT NULL default '0', + `topic_time` int(10) unsigned NOT NULL default '0', + `topic_views` int(10) unsigned NOT NULL default '0', + `topic_replies` mediumint(8) unsigned NOT NULL default '0', + `topic_last_post_id` int(8) unsigned NOT NULL default '0', + `forum_id` smallint(4) unsigned NOT NULL default '0', + `topic_status` tinyint(1) unsigned NOT NULL default '0', + `topic_subject` smallint(3) unsigned NOT NULL default '0', + `topic_sticky` tinyint(1) unsigned NOT NULL default '0', + `topic_digest` tinyint(1) unsigned NOT NULL default '0', + `digest_time` int(10) unsigned NOT NULL default '0', + `approved` tinyint(2) NOT NULL default '1', + `poster_name` varchar(255) NOT NULL default '', + `rating` double(6,4) NOT NULL default '0.0000', + `votes` int(11) unsigned NOT NULL default '0', + `topic_haspoll` tinyint(1) unsigned NOT NULL default '0', + `poll_id` mediumint(8) unsigned NOT NULL default '0', + PRIMARY KEY (`topic_id`), + KEY `forum_id` (`forum_id`), + KEY `topic_last_post_id` (`topic_last_post_id`), + KEY `topic_poster` (`topic_poster`), + KEY `topic_forum` (`topic_id`,`forum_id`), + KEY `topic_sticky` (`topic_sticky`), + KEY `topic_digest` (`topic_digest`), + KEY `digest_time` (`digest_time`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bb_votedata` +-- + +CREATE TABLE `bb_votedata` ( + `ratingid` int(11) unsigned NOT NULL auto_increment, + `topic_id` int(8) unsigned NOT NULL default '0', + `ratinguser` int(10) unsigned NOT NULL default '0', + `rating` tinyint(3) unsigned NOT NULL default '0', + `ratinghostname` varchar(60) NOT NULL default '', + `ratingtimestamp` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`ratingid`), + KEY `ratinguser` (`ratinguser`), + KEY `ratinghostname` (`ratinghostname`), + KEY `topic_id` (`topic_id`) +) TYPE=MyISAM; diff --git a/Scripts/Php/Newbb2Phpbb/schemas/phpBB3_mysql_41_schema.sql b/Scripts/Php/Newbb2Phpbb/schemas/phpBB3_mysql_41_schema.sql new file mode 100755 index 0000000..ad25ef5 --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/schemas/phpBB3_mysql_41_schema.sql @@ -0,0 +1,1003 @@ +# +# $Id: mysql_41_schema.sql 9129 2008-11-27 13:44:24Z acydburn $ +# + +# Table: 'phpbb_attachments' +CREATE TABLE phpbb_attachments ( + attach_id mediumint(8) UNSIGNED NOT NULL auto_increment, + post_msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + in_message tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + is_orphan tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + physical_filename varchar(255) DEFAULT '' NOT NULL, + real_filename varchar(255) DEFAULT '' NOT NULL, + download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + attach_comment text NOT NULL, + extension varchar(100) DEFAULT '' NOT NULL, + mimetype varchar(100) DEFAULT '' NOT NULL, + filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, + filetime int(11) UNSIGNED DEFAULT '0' NOT NULL, + thumbnail tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (attach_id), + KEY filetime (filetime), + KEY post_msg_id (post_msg_id), + KEY topic_id (topic_id), + KEY poster_id (poster_id), + KEY is_orphan (is_orphan) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_groups' +CREATE TABLE phpbb_acl_groups ( + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + KEY group_id (group_id), + KEY auth_opt_id (auth_option_id), + KEY auth_role_id (auth_role_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_options' +CREATE TABLE phpbb_acl_options ( + auth_option_id mediumint(8) UNSIGNED NOT NULL auto_increment, + auth_option varchar(50) DEFAULT '' NOT NULL, + is_global tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (auth_option_id), + KEY auth_option (auth_option) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_roles' +CREATE TABLE phpbb_acl_roles ( + role_id mediumint(8) UNSIGNED NOT NULL auto_increment, + role_name varchar(255) DEFAULT '' NOT NULL, + role_description text NOT NULL, + role_type varchar(10) DEFAULT '' NOT NULL, + role_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id), + KEY role_type (role_type), + KEY role_order (role_order) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_roles_data' +CREATE TABLE phpbb_acl_roles_data ( + role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id, auth_option_id), + KEY ath_op_id (auth_option_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_users' +CREATE TABLE phpbb_acl_users ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + KEY user_id (user_id), + KEY auth_option_id (auth_option_id), + KEY auth_role_id (auth_role_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_banlist' +CREATE TABLE phpbb_banlist ( + ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, + ban_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + ban_ip varchar(40) DEFAULT '' NOT NULL, + ban_email varchar(100) DEFAULT '' NOT NULL, + ban_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + ban_end int(11) UNSIGNED DEFAULT '0' NOT NULL, + ban_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ban_reason varchar(255) DEFAULT '' NOT NULL, + ban_give_reason varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (ban_id), + KEY ban_end (ban_end), + KEY ban_user (ban_userid, ban_exclude), + KEY ban_email (ban_email, ban_exclude), + KEY ban_ip (ban_ip, ban_exclude) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_bbcodes' +CREATE TABLE phpbb_bbcodes ( + bbcode_id tinyint(3) DEFAULT '0' NOT NULL, + bbcode_tag varchar(16) DEFAULT '' NOT NULL, + bbcode_helpline varchar(255) DEFAULT '' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_match text NOT NULL, + bbcode_tpl mediumtext NOT NULL, + first_pass_match mediumtext NOT NULL, + first_pass_replace mediumtext NOT NULL, + second_pass_match mediumtext NOT NULL, + second_pass_replace mediumtext NOT NULL, + PRIMARY KEY (bbcode_id), + KEY display_on_post (display_on_posting) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_bookmarks' +CREATE TABLE phpbb_bookmarks ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (topic_id, user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_bots' +CREATE TABLE phpbb_bots ( + bot_id mediumint(8) UNSIGNED NOT NULL auto_increment, + bot_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + bot_name varchar(255) DEFAULT '' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + bot_agent varchar(255) DEFAULT '' NOT NULL, + bot_ip varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (bot_id), + KEY bot_active (bot_active) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_config' +CREATE TABLE phpbb_config ( + config_name varchar(255) DEFAULT '' NOT NULL, + config_value varchar(255) DEFAULT '' NOT NULL, + is_dynamic tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (config_name), + KEY is_dynamic (is_dynamic) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_confirm' +CREATE TABLE phpbb_confirm ( + confirm_id char(32) DEFAULT '' NOT NULL, + session_id char(32) DEFAULT '' NOT NULL, + confirm_type tinyint(3) DEFAULT '0' NOT NULL, + code varchar(8) DEFAULT '' NOT NULL, + seed int(10) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id, confirm_id), + KEY confirm_type (confirm_type) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_disallow' +CREATE TABLE phpbb_disallow ( + disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, + disallow_username varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (disallow_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_drafts' +CREATE TABLE phpbb_drafts ( + draft_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + save_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + draft_subject varchar(255) DEFAULT '' NOT NULL, + draft_message mediumtext NOT NULL, + PRIMARY KEY (draft_id), + KEY save_time (save_time) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_extensions' +CREATE TABLE phpbb_extensions ( + extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + extension varchar(100) DEFAULT '' NOT NULL, + PRIMARY KEY (extension_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_extension_groups' +CREATE TABLE phpbb_extension_groups ( + group_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_name varchar(255) DEFAULT '' NOT NULL, + cat_id tinyint(2) DEFAULT '0' NOT NULL, + allow_group tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + download_mode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + upload_icon varchar(255) DEFAULT '' NOT NULL, + max_filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, + allowed_forums text NOT NULL, + allow_in_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (group_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums' +CREATE TABLE phpbb_forums ( + forum_id mediumint(8) UNSIGNED NOT NULL auto_increment, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_parents mediumtext NOT NULL, + forum_name varchar(255) DEFAULT '' NOT NULL, + forum_desc text NOT NULL, + forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + forum_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + forum_desc_uid varchar(8) DEFAULT '' NOT NULL, + forum_link varchar(255) DEFAULT '' NOT NULL, + forum_password varchar(40) DEFAULT '' NOT NULL, + forum_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_image varchar(255) DEFAULT '' NOT NULL, + forum_rules text NOT NULL, + forum_rules_link varchar(255) DEFAULT '' NOT NULL, + forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL, + forum_rules_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + forum_rules_uid varchar(8) DEFAULT '' NOT NULL, + forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, + forum_type tinyint(4) DEFAULT '0' NOT NULL, + forum_status tinyint(4) DEFAULT '0' NOT NULL, + forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, + forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, + forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + forum_flags tinyint(4) DEFAULT '32' NOT NULL, + display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + prune_next int(11) UNSIGNED DEFAULT '0' NOT NULL, + prune_days mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + prune_viewed mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + prune_freq mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (forum_id), + KEY left_right_id (left_id, right_id), + KEY forum_lastpost_id (forum_last_post_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums_access' +CREATE TABLE phpbb_forums_access ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_id char(32) DEFAULT '' NOT NULL, + PRIMARY KEY (forum_id, user_id, session_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums_track' +CREATE TABLE phpbb_forums_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums_watch' +CREATE TABLE phpbb_forums_watch ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + KEY forum_id (forum_id), + KEY user_id (user_id), + KEY notify_stat (notify_status) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_groups' +CREATE TABLE phpbb_groups ( + group_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_type tinyint(4) DEFAULT '1' NOT NULL, + group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_name varchar(255) DEFAULT '' NOT NULL, + group_desc text NOT NULL, + group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + group_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + group_desc_uid varchar(8) DEFAULT '' NOT NULL, + group_display tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_avatar varchar(255) DEFAULT '' NOT NULL, + group_avatar_type tinyint(2) DEFAULT '0' NOT NULL, + group_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + group_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + group_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_colour varchar(6) DEFAULT '' NOT NULL, + group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_legend tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (group_id), + KEY group_legend_name (group_legend, group_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_icons' +CREATE TABLE phpbb_icons ( + icons_id mediumint(8) UNSIGNED NOT NULL auto_increment, + icons_url varchar(255) DEFAULT '' NOT NULL, + icons_width tinyint(4) DEFAULT '0' NOT NULL, + icons_height tinyint(4) DEFAULT '0' NOT NULL, + icons_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (icons_id), + KEY display_on_posting (display_on_posting) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_lang' +CREATE TABLE phpbb_lang ( + lang_id tinyint(4) NOT NULL auto_increment, + lang_iso varchar(30) DEFAULT '' NOT NULL, + lang_dir varchar(30) DEFAULT '' NOT NULL, + lang_english_name varchar(100) DEFAULT '' NOT NULL, + lang_local_name varchar(255) DEFAULT '' NOT NULL, + lang_author varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (lang_id), + KEY lang_iso (lang_iso) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_log' +CREATE TABLE phpbb_log ( + log_id mediumint(8) UNSIGNED NOT NULL auto_increment, + log_type tinyint(4) DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + reportee_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + log_ip varchar(40) DEFAULT '' NOT NULL, + log_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + log_operation text NOT NULL, + log_data mediumtext NOT NULL, + PRIMARY KEY (log_id), + KEY log_type (log_type), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY reportee_id (reportee_id), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_moderator_cache' +CREATE TABLE phpbb_moderator_cache ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username varchar(255) DEFAULT '' NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_name varchar(255) DEFAULT '' NOT NULL, + display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + KEY disp_idx (display_on_index), + KEY forum_id (forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_modules' +CREATE TABLE phpbb_modules ( + module_id mediumint(8) UNSIGNED NOT NULL auto_increment, + module_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + module_display tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + module_basename varchar(255) DEFAULT '' NOT NULL, + module_class varchar(10) DEFAULT '' NOT NULL, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + module_langname varchar(255) DEFAULT '' NOT NULL, + module_mode varchar(255) DEFAULT '' NOT NULL, + module_auth varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (module_id), + KEY left_right_id (left_id, right_id), + KEY module_enabled (module_enabled), + KEY class_left_id (module_class, left_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_poll_options' +CREATE TABLE phpbb_poll_options ( + poll_option_id tinyint(4) DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_option_text text NOT NULL, + poll_option_total mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + KEY poll_opt_id (poll_option_id), + KEY topic_id (topic_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_poll_votes' +CREATE TABLE phpbb_poll_votes ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_option_id tinyint(4) DEFAULT '0' NOT NULL, + vote_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + vote_user_ip varchar(40) DEFAULT '' NOT NULL, + KEY topic_id (topic_id), + KEY vote_user_id (vote_user_id), + KEY vote_user_ip (vote_user_ip) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_posts' +CREATE TABLE phpbb_posts ( + post_id mediumint(8) UNSIGNED NOT NULL auto_increment, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_ip varchar(40) DEFAULT '' NOT NULL, + post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_username varchar(255) DEFAULT '' NOT NULL, + post_subject varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci, + post_text mediumtext NOT NULL, + post_checksum varchar(32) DEFAULT '' NOT NULL, + post_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + bbcode_uid varchar(8) DEFAULT '' NOT NULL, + post_postcount tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_reason varchar(255) DEFAULT '' NOT NULL, + post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (post_id), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY poster_ip (poster_ip), + KEY poster_id (poster_id), + KEY post_approved (post_approved), + KEY tid_post_time (topic_id, post_time) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs' +CREATE TABLE phpbb_privmsgs ( + msg_id mediumint(8) UNSIGNED NOT NULL auto_increment, + root_level mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_ip varchar(40) DEFAULT '' NOT NULL, + message_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + message_subject varchar(255) DEFAULT '' NOT NULL, + message_text mediumtext NOT NULL, + message_edit_reason varchar(255) DEFAULT '' NOT NULL, + message_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + message_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + bbcode_uid varchar(8) DEFAULT '' NOT NULL, + message_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + to_address text NOT NULL, + bcc_address text NOT NULL, + PRIMARY KEY (msg_id), + KEY author_ip (author_ip), + KEY message_time (message_time), + KEY author_id (author_id), + KEY root_level (root_level) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs_folder' +CREATE TABLE phpbb_privmsgs_folder ( + folder_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + folder_name varchar(255) DEFAULT '' NOT NULL, + pm_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (folder_id), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs_rules' +CREATE TABLE phpbb_privmsgs_rules ( + rule_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_check mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_connection mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_string varchar(255) DEFAULT '' NOT NULL, + rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_folder_id int(11) DEFAULT '0' NOT NULL, + PRIMARY KEY (rule_id), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs_to' +CREATE TABLE phpbb_privmsgs_to ( + msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_deleted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + pm_unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + folder_id int(11) DEFAULT '0' NOT NULL, + KEY msg_id (msg_id), + KEY author_id (author_id), + KEY usr_flder_id (user_id, folder_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_fields' +CREATE TABLE phpbb_profile_fields ( + field_id mediumint(8) UNSIGNED NOT NULL auto_increment, + field_name varchar(255) DEFAULT '' NOT NULL, + field_type tinyint(4) DEFAULT '0' NOT NULL, + field_ident varchar(20) DEFAULT '' NOT NULL, + field_length varchar(20) DEFAULT '' NOT NULL, + field_minlen varchar(255) DEFAULT '' NOT NULL, + field_maxlen varchar(255) DEFAULT '' NOT NULL, + field_novalue varchar(255) DEFAULT '' NOT NULL, + field_default_value varchar(255) DEFAULT '' NOT NULL, + field_validation varchar(20) DEFAULT '' NOT NULL, + field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (field_id), + KEY fld_type (field_type), + KEY fld_ordr (field_order) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_fields_data' +CREATE TABLE phpbb_profile_fields_data ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_fields_lang' +CREATE TABLE phpbb_profile_fields_lang ( + field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + field_type tinyint(4) DEFAULT '0' NOT NULL, + lang_value varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (field_id, lang_id, option_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_lang' +CREATE TABLE phpbb_profile_lang ( + field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_name varchar(255) DEFAULT '' NOT NULL, + lang_explain text NOT NULL, + lang_default_value varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (field_id, lang_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_ranks' +CREATE TABLE phpbb_ranks ( + rank_id mediumint(8) UNSIGNED NOT NULL auto_increment, + rank_title varchar(255) DEFAULT '' NOT NULL, + rank_min mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rank_special tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + rank_image varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (rank_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_reports' +CREATE TABLE phpbb_reports ( + report_id mediumint(8) UNSIGNED NOT NULL auto_increment, + reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + report_text mediumtext NOT NULL, + PRIMARY KEY (report_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_reports_reasons' +CREATE TABLE phpbb_reports_reasons ( + reason_id smallint(4) UNSIGNED NOT NULL auto_increment, + reason_title varchar(255) DEFAULT '' NOT NULL, + reason_description mediumtext NOT NULL, + reason_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (reason_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_search_results' +CREATE TABLE phpbb_search_results ( + search_key varchar(32) DEFAULT '' NOT NULL, + search_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + search_keywords mediumtext NOT NULL, + search_authors mediumtext NOT NULL, + PRIMARY KEY (search_key) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_search_wordlist' +CREATE TABLE phpbb_search_wordlist ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word_text varchar(255) DEFAULT '' NOT NULL, + word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (word_id), + UNIQUE wrd_txt (word_text), + KEY wrd_cnt (word_count) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_search_wordmatch' +CREATE TABLE phpbb_search_wordmatch ( + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + word_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + title_match tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + UNIQUE unq_mtch (word_id, post_id, title_match), + KEY word_id (word_id), + KEY post_id (post_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_sessions' +CREATE TABLE phpbb_sessions ( + session_id char(32) DEFAULT '' NOT NULL, + session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_last_visit int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_ip varchar(40) DEFAULT '' NOT NULL, + session_browser varchar(150) DEFAULT '' NOT NULL, + session_forwarded_for varchar(255) DEFAULT '' NOT NULL, + session_page varchar(255) DEFAULT '' NOT NULL, + session_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + session_autologin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + session_admin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id), + KEY session_time (session_time), + KEY session_user_id (session_user_id), + KEY session_fid (session_forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_sessions_keys' +CREATE TABLE phpbb_sessions_keys ( + key_id char(32) DEFAULT '' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + last_ip varchar(40) DEFAULT '' NOT NULL, + last_login int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (key_id, user_id), + KEY last_login (last_login) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_sitelist' +CREATE TABLE phpbb_sitelist ( + site_id mediumint(8) UNSIGNED NOT NULL auto_increment, + site_ip varchar(40) DEFAULT '' NOT NULL, + site_hostname varchar(255) DEFAULT '' NOT NULL, + ip_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (site_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_smilies' +CREATE TABLE phpbb_smilies ( + smiley_id mediumint(8) UNSIGNED NOT NULL auto_increment, + code varchar(50) DEFAULT '' NOT NULL, + emotion varchar(50) DEFAULT '' NOT NULL, + smiley_url varchar(50) DEFAULT '' NOT NULL, + smiley_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (smiley_id), + KEY display_on_post (display_on_posting) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_styles' +CREATE TABLE phpbb_styles ( + style_id mediumint(8) UNSIGNED NOT NULL auto_increment, + style_name varchar(255) DEFAULT '' NOT NULL, + style_copyright varchar(255) DEFAULT '' NOT NULL, + style_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + template_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + theme_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + imageset_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (style_id), + UNIQUE style_name (style_name), + KEY template_id (template_id), + KEY theme_id (theme_id), + KEY imageset_id (imageset_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_styles_template' +CREATE TABLE phpbb_styles_template ( + template_id mediumint(8) UNSIGNED NOT NULL auto_increment, + template_name varchar(255) DEFAULT '' NOT NULL, + template_copyright varchar(255) DEFAULT '' NOT NULL, + template_path varchar(100) DEFAULT '' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL, + template_storedb tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + template_inherits_id int(4) UNSIGNED DEFAULT '0' NOT NULL, + template_inherit_path varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (template_id), + UNIQUE tmplte_nm (template_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_styles_template_data' +CREATE TABLE phpbb_styles_template_data ( + template_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + template_filename varchar(100) DEFAULT '' NOT NULL, + template_included text NOT NULL, + template_mtime int(11) UNSIGNED DEFAULT '0' NOT NULL, + template_data mediumtext NOT NULL, + KEY tid (template_id), + KEY tfn (template_filename) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_styles_theme' +CREATE TABLE phpbb_styles_theme ( + theme_id mediumint(8) UNSIGNED NOT NULL auto_increment, + theme_name varchar(255) DEFAULT '' NOT NULL, + theme_copyright varchar(255) DEFAULT '' NOT NULL, + theme_path varchar(100) DEFAULT '' NOT NULL, + theme_storedb tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + theme_mtime int(11) UNSIGNED DEFAULT '0' NOT NULL, + theme_data mediumtext NOT NULL, + PRIMARY KEY (theme_id), + UNIQUE theme_name (theme_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_styles_imageset' +CREATE TABLE phpbb_styles_imageset ( + imageset_id mediumint(8) UNSIGNED NOT NULL auto_increment, + imageset_name varchar(255) DEFAULT '' NOT NULL, + imageset_copyright varchar(255) DEFAULT '' NOT NULL, + imageset_path varchar(100) DEFAULT '' NOT NULL, + PRIMARY KEY (imageset_id), + UNIQUE imgset_nm (imageset_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_styles_imageset_data' +CREATE TABLE phpbb_styles_imageset_data ( + image_id mediumint(8) UNSIGNED NOT NULL auto_increment, + image_name varchar(200) DEFAULT '' NOT NULL, + image_filename varchar(200) DEFAULT '' NOT NULL, + image_lang varchar(30) DEFAULT '' NOT NULL, + image_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + image_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + imageset_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (image_id), + KEY i_d (imageset_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics' +CREATE TABLE phpbb_topics ( + topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_title varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci, + topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_status tinyint(3) DEFAULT '0' NOT NULL, + topic_type tinyint(3) DEFAULT '0' NOT NULL, + topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_subject varchar(255) DEFAULT '' NOT NULL, + topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_bumped tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_bumper mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_title varchar(255) DEFAULT '' NOT NULL, + poll_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_length int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_max_options tinyint(4) DEFAULT '1' NOT NULL, + poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (topic_id), + KEY forum_id (forum_id), + KEY forum_id_type (forum_id, topic_type), + KEY last_post_time (topic_last_post_time), + KEY topic_approved (topic_approved), + KEY forum_appr_last (forum_id, topic_approved, topic_last_post_id), + KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics_track' +CREATE TABLE phpbb_topics_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, topic_id), + KEY forum_id (forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics_posted' +CREATE TABLE phpbb_topics_posted ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, topic_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics_watch' +CREATE TABLE phpbb_topics_watch ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + KEY topic_id (topic_id), + KEY user_id (user_id), + KEY notify_stat (notify_status) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_user_group' +CREATE TABLE phpbb_user_group ( + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_leader tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_pending tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + KEY group_id (group_id), + KEY user_id (user_id), + KEY group_leader (group_leader) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_users' +CREATE TABLE phpbb_users ( + user_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_type tinyint(2) DEFAULT '0' NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '3' NOT NULL, + user_permissions mediumtext NOT NULL, + user_perm_from mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_ip varchar(40) DEFAULT '' NOT NULL, + user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL, + username varchar(255) DEFAULT '' NOT NULL, + username_clean varchar(255) DEFAULT '' NOT NULL, + user_password varchar(40) DEFAULT '' NOT NULL, + user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_email varchar(100) DEFAULT '' NOT NULL, + user_email_hash bigint(20) DEFAULT '0' NOT NULL, + user_birthday varchar(10) DEFAULT '' NOT NULL, + user_lastvisit int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastpost_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastpage varchar(200) DEFAULT '' NOT NULL, + user_last_confirm_key varchar(10) DEFAULT '' NOT NULL, + user_last_search int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_warnings tinyint(4) DEFAULT '0' NOT NULL, + user_last_warning int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_login_attempts tinyint(4) DEFAULT '0' NOT NULL, + user_inactive_reason tinyint(2) DEFAULT '0' NOT NULL, + user_inactive_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_lang varchar(30) DEFAULT '' NOT NULL, + user_timezone decimal(5,2) DEFAULT '0' NOT NULL, + user_dst tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL, + user_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_colour varchar(6) DEFAULT '' NOT NULL, + user_new_privmsg int(4) DEFAULT '0' NOT NULL, + user_unread_privmsg int(4) DEFAULT '0' NOT NULL, + user_last_privmsg int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_full_folder int(11) DEFAULT '-3' NOT NULL, + user_emailtime int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_topic_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL, + user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL, + user_post_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL, + user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL, + user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_notify_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_notify_type tinyint(4) DEFAULT '0' NOT NULL, + user_allow_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_options int(11) UNSIGNED DEFAULT '895' NOT NULL, + user_avatar varchar(255) DEFAULT '' NOT NULL, + user_avatar_type tinyint(2) DEFAULT '0' NOT NULL, + user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_sig mediumtext NOT NULL, + user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + user_from varchar(100) DEFAULT '' NOT NULL, + user_icq varchar(15) DEFAULT '' NOT NULL, + user_aim varchar(255) DEFAULT '' NOT NULL, + user_yim varchar(255) DEFAULT '' NOT NULL, + user_msnm varchar(255) DEFAULT '' NOT NULL, + user_jabber varchar(255) DEFAULT '' NOT NULL, + user_website varchar(200) DEFAULT '' NOT NULL, + user_occ text NOT NULL, + user_interests text NOT NULL, + user_actkey varchar(32) DEFAULT '' NOT NULL, + user_newpasswd varchar(40) DEFAULT '' NOT NULL, + user_form_salt varchar(32) DEFAULT '' NOT NULL, + PRIMARY KEY (user_id), + KEY user_birthday (user_birthday), + KEY user_email_hash (user_email_hash), + KEY user_type (user_type), + UNIQUE username_clean (username_clean) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_warnings' +CREATE TABLE phpbb_warnings ( + warning_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + log_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + warning_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (warning_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_words' +CREATE TABLE phpbb_words ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word varchar(255) DEFAULT '' NOT NULL, + replacement varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (word_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_zebra' +CREATE TABLE phpbb_zebra ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + zebra_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + friend tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + foe tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, zebra_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + diff --git a/Scripts/Php/Newbb2Phpbb/schemas/xoops_mysql_schema.sql b/Scripts/Php/Newbb2Phpbb/schemas/xoops_mysql_schema.sql new file mode 100755 index 0000000..ae6b895 --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/schemas/xoops_mysql_schema.sql @@ -0,0 +1,570 @@ +# +# Table structure for table `avatar` +# + +CREATE TABLE avatar ( + avatar_id mediumint(8) unsigned NOT NULL auto_increment, + avatar_file varchar(30) NOT NULL default '', + avatar_name varchar(100) NOT NULL default '', + avatar_mimetype varchar(30) NOT NULL default '', + avatar_created int(10) NOT NULL default '0', + avatar_display tinyint(1) unsigned NOT NULL default '0', + avatar_weight smallint(5) unsigned NOT NULL default '0', + avatar_type char(1) NOT NULL default '', + PRIMARY KEY (avatar_id), + KEY avatar_type (avatar_type, avatar_display) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `avatar_user_link` +# + +CREATE TABLE avatar_user_link ( + avatar_id mediumint(8) unsigned NOT NULL default '0', + user_id mediumint(8) unsigned NOT NULL default '0', + KEY avatar_user_id (avatar_id,user_id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `banner` +# + +CREATE TABLE banner ( + bid smallint(5) unsigned NOT NULL auto_increment, + cid tinyint(3) unsigned NOT NULL default '0', + imptotal mediumint(8) unsigned NOT NULL default '0', + impmade mediumint(8) unsigned NOT NULL default '0', + clicks mediumint(8) unsigned NOT NULL default '0', + imageurl varchar(255) NOT NULL default '', + clickurl varchar(255) NOT NULL default '', + date int(10) NOT NULL default '0', + htmlbanner tinyint(1) NOT NULL default '0', + htmlcode text, + PRIMARY KEY (bid), + KEY idxbannercid (cid), + KEY idxbannerbidcid (bid,cid) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `bannerclient` +# + +CREATE TABLE bannerclient ( + cid smallint(5) unsigned NOT NULL auto_increment, + name varchar(60) NOT NULL default '', + contact varchar(60) NOT NULL default '', + email varchar(60) NOT NULL default '', + login varchar(10) NOT NULL default '', + passwd varchar(10) NOT NULL default '', + extrainfo text, + PRIMARY KEY (cid), + KEY login (login) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `bannerfinish` +# + +CREATE TABLE bannerfinish ( + bid smallint(5) unsigned NOT NULL auto_increment, + cid smallint(5) unsigned NOT NULL default '0', + impressions mediumint(8) unsigned NOT NULL default '0', + clicks mediumint(8) unsigned NOT NULL default '0', + datestart int(10) unsigned NOT NULL default '0', + dateend int(10) unsigned NOT NULL default '0', + PRIMARY KEY (bid), + KEY cid (cid) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `block_module_link` +# + +CREATE TABLE block_module_link ( + block_id mediumint(8) unsigned NOT NULL default '0', + module_id smallint(5) NOT NULL default '0', + PRIMARY KEY (`module_id`, `block_id`) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `comments` +# + +CREATE TABLE xoopscomments ( + com_id mediumint(8) unsigned NOT NULL auto_increment, + com_pid mediumint(8) unsigned NOT NULL default '0', + com_rootid mediumint(8) unsigned NOT NULL default '0', + com_modid smallint(5) unsigned NOT NULL default '0', + com_itemid mediumint(8) unsigned NOT NULL default '0', + com_icon varchar(25) NOT NULL default '', + com_created int(10) unsigned NOT NULL default '0', + com_modified int(10) unsigned NOT NULL default '0', + com_uid mediumint(8) unsigned NOT NULL default '0', + com_ip varchar(15) NOT NULL default '', + com_title varchar(255) NOT NULL default '', + com_text text, + com_sig tinyint(1) unsigned NOT NULL default '0', + com_status tinyint(1) unsigned NOT NULL default '0', + com_exparams varchar(255) NOT NULL default '', + dohtml tinyint(1) unsigned NOT NULL default '0', + dosmiley tinyint(1) unsigned NOT NULL default '0', + doxcode tinyint(1) unsigned NOT NULL default '0', + doimage tinyint(1) unsigned NOT NULL default '0', + dobr tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (com_id), + KEY com_pid (com_pid), + KEY com_itemid (com_itemid), + KEY com_uid (com_uid), + KEY com_title (com_title(40)) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# RMV-NOTIFY +# Table structure for table `notifications` +# + +CREATE TABLE xoopsnotifications ( + not_id mediumint(8) unsigned NOT NULL auto_increment, + not_modid smallint(5) unsigned NOT NULL default '0', + not_itemid mediumint(8) unsigned NOT NULL default '0', + not_category varchar(30) NOT NULL default '', + not_event varchar(30) NOT NULL default '', + not_uid mediumint(8) unsigned NOT NULL default '0', + not_mode tinyint(1) NOT NULL default 0, + PRIMARY KEY (not_id), + KEY not_modid (not_modid), + KEY not_itemid (not_itemid), + KEY not_class (not_category), + KEY not_uid (not_uid), + KEY not_event (not_event) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `config` +# + +CREATE TABLE config ( + conf_id smallint(5) unsigned NOT NULL auto_increment, + conf_modid smallint(5) unsigned NOT NULL default '0', + conf_catid smallint(5) unsigned NOT NULL default '0', + conf_name varchar(25) NOT NULL default '', + conf_title varchar(255) NOT NULL default '', + conf_value text, + conf_desc varchar(255) NOT NULL default '', + conf_formtype varchar(15) NOT NULL default '', + conf_valuetype varchar(10) NOT NULL default '', + conf_order smallint(5) unsigned NOT NULL default '0', + PRIMARY KEY (conf_id), + KEY conf_mod_cat_id (conf_modid, conf_catid) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `configcategory` +# + +CREATE TABLE configcategory ( + confcat_id smallint(5) unsigned NOT NULL auto_increment, + confcat_name varchar(255) NOT NULL default '', + confcat_order smallint(5) unsigned NOT NULL default '0', + PRIMARY KEY (confcat_id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `configoption` +# + +CREATE TABLE configoption ( + confop_id mediumint(8) unsigned NOT NULL auto_increment, + confop_name varchar(255) NOT NULL default '', + confop_value varchar(255) NOT NULL default '', + conf_id smallint(5) unsigned NOT NULL default '0', + PRIMARY KEY (confop_id), + KEY conf_id (conf_id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `groups` +# + +CREATE TABLE groups ( + groupid smallint(5) unsigned NOT NULL auto_increment, + name varchar(50) NOT NULL default '', + description text, + group_type varchar(10) NOT NULL default '', + PRIMARY KEY (groupid), + KEY group_type (group_type) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `group_permission` +# + +CREATE TABLE group_permission ( + gperm_id int(10) unsigned NOT NULL auto_increment, + gperm_groupid smallint(5) unsigned NOT NULL default '0', + gperm_itemid mediumint(8) unsigned NOT NULL default '0', + gperm_modid mediumint(5) unsigned NOT NULL default '0', + gperm_name varchar(50) NOT NULL default '', + PRIMARY KEY (gperm_id), + KEY groupid (gperm_groupid), + KEY itemid (gperm_itemid), + KEY gperm_modid (gperm_modid,gperm_name(10)) +) TYPE=MyISAM; +# -------------------------------------------------------- + + +# +# Table structure for table `groups_users_link` +# + +CREATE TABLE groups_users_link ( + linkid mediumint(8) unsigned NOT NULL auto_increment, + groupid smallint(5) unsigned NOT NULL default '0', + uid mediumint(8) unsigned NOT NULL default '0', + PRIMARY KEY (linkid), + KEY groupid_uid (groupid,uid) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `image` +# + +CREATE TABLE image ( + image_id mediumint(8) unsigned NOT NULL auto_increment, + image_name varchar(30) NOT NULL default '', + image_nicename varchar(255) NOT NULL default '', + image_mimetype varchar(30) NOT NULL default '', + image_created int(10) unsigned NOT NULL default '0', + image_display tinyint(1) unsigned NOT NULL default '0', + image_weight smallint(5) unsigned NOT NULL default '0', + imgcat_id smallint(5) unsigned NOT NULL default '0', + PRIMARY KEY (image_id), + KEY imgcat_id (imgcat_id), + KEY image_display (image_display) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `imagebody` +# + +CREATE TABLE imagebody ( + image_id mediumint(8) unsigned NOT NULL default '0', + image_body mediumblob, + KEY image_id (image_id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `imagecategory` +# + +CREATE TABLE imagecategory ( + imgcat_id smallint(5) unsigned NOT NULL auto_increment, + imgcat_name varchar(100) NOT NULL default '', + imgcat_maxsize int(8) unsigned NOT NULL default '0', + imgcat_maxwidth smallint(3) unsigned NOT NULL default '0', + imgcat_maxheight smallint(3) unsigned NOT NULL default '0', + imgcat_display tinyint(1) unsigned NOT NULL default '0', + imgcat_weight smallint(3) unsigned NOT NULL default '0', + imgcat_type char(1) NOT NULL default '', + imgcat_storetype varchar(5) NOT NULL default '', + PRIMARY KEY (imgcat_id), + KEY imgcat_display (imgcat_display) +) TYPE=MyISAM; +# -------------------------------------------------------- + + +# +# Table structure for table `imgset` +# + +CREATE TABLE imgset ( + imgset_id smallint(5) unsigned NOT NULL auto_increment, + imgset_name varchar(50) NOT NULL default '', + imgset_refid mediumint(8) unsigned NOT NULL default '0', + PRIMARY KEY (imgset_id), + KEY imgset_refid (imgset_refid) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `imgset_tplset_link` +# + +CREATE TABLE imgset_tplset_link ( + imgset_id smallint(5) unsigned NOT NULL default '0', + tplset_name varchar(50) NOT NULL default '', + KEY tplset_name (tplset_name(10)) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `imgsetimg` +# + +CREATE TABLE imgsetimg ( + imgsetimg_id mediumint(8) unsigned NOT NULL auto_increment, + imgsetimg_file varchar(50) NOT NULL default '', + imgsetimg_body blob, + imgsetimg_imgset smallint(5) unsigned NOT NULL default '0', + PRIMARY KEY (imgsetimg_id), + KEY imgsetimg_imgset (imgsetimg_imgset) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `modules` +# + +CREATE TABLE modules ( + mid smallint(5) unsigned NOT NULL auto_increment, + name varchar(150) NOT NULL default '', + version smallint(5) unsigned NOT NULL default '100', + last_update int(10) unsigned NOT NULL default '0', + weight smallint(3) unsigned NOT NULL default '0', + isactive tinyint(1) unsigned NOT NULL default '0', + dirname varchar(25) NOT NULL default '', + hasmain tinyint(1) unsigned NOT NULL default '0', + hasadmin tinyint(1) unsigned NOT NULL default '0', + hassearch tinyint(1) unsigned NOT NULL default '0', + hasconfig tinyint(1) unsigned NOT NULL default '0', + hascomments tinyint(1) unsigned NOT NULL default '0', + hasnotification tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (mid), + KEY hasmain (hasmain), + KEY hasadmin (hasadmin), + KEY hassearch (hassearch), + KEY hasnotification (hasnotification), + KEY dirname (dirname), + KEY name (name(15)) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `newblocks` +# + +CREATE TABLE newblocks ( + bid mediumint(8) unsigned NOT NULL auto_increment, + mid smallint(5) unsigned NOT NULL default '0', + func_num tinyint(3) unsigned NOT NULL default '0', + options varchar(255) NOT NULL default '', + name varchar(150) NOT NULL default '', + title varchar(255) NOT NULL default '', + content text, + side tinyint(1) unsigned NOT NULL default '0', + weight smallint(5) unsigned NOT NULL default '0', + visible tinyint(1) unsigned NOT NULL default '0', + block_type char(1) NOT NULL default '', + c_type char(1) NOT NULL default '', + isactive tinyint(1) unsigned NOT NULL default '0', + dirname varchar(50) NOT NULL default '', + func_file varchar(50) NOT NULL default '', + show_func varchar(50) NOT NULL default '', + edit_func varchar(50) NOT NULL default '', + template varchar(50) NOT NULL default '', + bcachetime int(10) unsigned NOT NULL default '0', + last_modified int(10) unsigned NOT NULL default '0', + PRIMARY KEY (bid), + KEY mid (mid), + KEY visible (visible), + KEY isactive_visible_mid (isactive,visible,mid), + KEY mid_funcnum (mid,func_num) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `online` +# + +CREATE TABLE online ( + online_uid mediumint(8) unsigned NOT NULL default '0', + online_uname varchar(25) NOT NULL default '', + online_updated int(10) unsigned NOT NULL default '0', + online_module smallint(5) unsigned NOT NULL default '0', + online_ip varchar(15) NOT NULL default '', + KEY online_module (online_module) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `priv_msgs` +# + +CREATE TABLE priv_msgs ( + msg_id mediumint(8) unsigned NOT NULL auto_increment, + msg_image varchar(100) default NULL, + subject varchar(255) NOT NULL default '', + from_userid mediumint(8) unsigned NOT NULL default '0', + to_userid mediumint(8) unsigned NOT NULL default '0', + msg_time int(10) unsigned NOT NULL default '0', + msg_text text, + read_msg tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (msg_id), + KEY to_userid (to_userid), + KEY touseridreadmsg (to_userid,read_msg), + KEY msgidfromuserid (msg_id,from_userid) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `ranks` +# + +CREATE TABLE ranks ( + rank_id smallint(5) unsigned NOT NULL auto_increment, + rank_title varchar(50) NOT NULL default '', + rank_min mediumint(8) unsigned NOT NULL default '0', + rank_max mediumint(8) unsigned NOT NULL default '0', + rank_special tinyint(1) unsigned NOT NULL default '0', + rank_image varchar(255) default NULL, + PRIMARY KEY (rank_id), + KEY rank_min (rank_min), + KEY rank_max (rank_max), + KEY rankminrankmaxranspecial (rank_min,rank_max,rank_special), + KEY rankspecial (rank_special) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `session` +# + +CREATE TABLE session ( + sess_id varchar(32) NOT NULL default '', + sess_updated int(10) unsigned NOT NULL default '0', + sess_ip varchar(15) NOT NULL default '', + sess_data text, + PRIMARY KEY (sess_id), + KEY updated (sess_updated) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `smiles` +# + +CREATE TABLE smiles ( + id smallint(5) unsigned NOT NULL auto_increment, + code varchar(50) NOT NULL default '', + smile_url varchar(100) NOT NULL default '', + emotion varchar(75) NOT NULL default '', + display tinyint(1) NOT NULL default '0', + PRIMARY KEY (id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `tplset` +# + +CREATE TABLE tplset ( + tplset_id int(7) unsigned NOT NULL auto_increment, + tplset_name varchar(50) NOT NULL default '', + tplset_desc varchar(255) NOT NULL default '', + tplset_credits text, + tplset_created int(10) unsigned NOT NULL default '0', + PRIMARY KEY (tplset_id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `tplfile` +# + +CREATE TABLE tplfile ( + tpl_id mediumint(7) unsigned NOT NULL auto_increment, + tpl_refid smallint(5) unsigned NOT NULL default '0', + tpl_module varchar(25) NOT NULL default '', + tpl_tplset varchar(50) NOT NULL default '', + tpl_file varchar(50) NOT NULL default '', + tpl_desc varchar(255) NOT NULL default '', + tpl_lastmodified int(10) unsigned NOT NULL default '0', + tpl_lastimported int(10) unsigned NOT NULL default '0', + tpl_type varchar(20) NOT NULL default '', + PRIMARY KEY (tpl_id), + KEY tpl_refid (tpl_refid,tpl_type), + KEY tpl_tplset (tpl_tplset,tpl_file(10)) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `tplsource` +# + +CREATE TABLE tplsource ( + tpl_id mediumint(7) unsigned NOT NULL default '0', + tpl_source mediumtext, + KEY tpl_id (tpl_id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# Table structure for table `users` +# + +CREATE TABLE users ( + uid mediumint(8) unsigned NOT NULL auto_increment, + name varchar(60) NOT NULL default '', + uname varchar(25) NOT NULL default '', + email varchar(60) NOT NULL default '', + url varchar(100) NOT NULL default '', + user_avatar varchar(30) NOT NULL default 'blank.gif', + user_regdate int(10) unsigned NOT NULL default '0', + user_icq varchar(15) NOT NULL default '', + user_from varchar(100) NOT NULL default '', + user_sig tinytext, + user_viewemail tinyint(1) unsigned NOT NULL default '0', + actkey varchar(8) NOT NULL default '', + user_aim varchar(18) NOT NULL default '', + user_yim varchar(25) NOT NULL default '', + user_msnm varchar(100) NOT NULL default '', + pass varchar(32) NOT NULL default '', + posts mediumint(8) unsigned NOT NULL default '0', + attachsig tinyint(1) unsigned NOT NULL default '0', + rank smallint(5) unsigned NOT NULL default '0', + level tinyint(3) unsigned NOT NULL default '1', + theme varchar(100) NOT NULL default '', + timezone_offset float(3,1) NOT NULL default '0.0', + last_login int(10) unsigned NOT NULL default '0', + umode varchar(10) NOT NULL default '', + uorder tinyint(1) unsigned NOT NULL default '0', + notify_method tinyint(1) NOT NULL default '1', + notify_mode tinyint(1) NOT NULL default '0', + user_occ varchar(100) NOT NULL default '', + bio tinytext, + user_intrest varchar(150) NOT NULL default '', + user_mailok tinyint(1) unsigned NOT NULL default '1', + PRIMARY KEY (uid), + KEY uname (uname), + KEY email (email), + KEY uiduname (uid,uname), + KEY unamepass (uname,pass) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `cache_model` +# + +CREATE TABLE cache_model ( + `cache_key` varchar(64) NOT NULL default '', + `cache_expires` int(10) unsigned NOT NULL default '0', + `cache_data` text, + + PRIMARY KEY (`cache_key`), + KEY `cache_expires` (`cache_expires`) +) TYPE=MyISAM; +# -------------------------------------------------------- diff --git a/Scripts/Php/Newbb2Phpbb/style.css b/Scripts/Php/Newbb2Phpbb/style.css new file mode 100755 index 0000000..6c13dba --- /dev/null +++ b/Scripts/Php/Newbb2Phpbb/style.css @@ -0,0 +1,323 @@ +/* + * Convert Xoops + CBB (newbb) to phpBB + * Style Sheet. + * + */ + +html { + background-image:url(img/html-bg.png); + background-color: #FFF; + font-family: "DejaVu Sans", "Liberation Sans", sans-serif; + font-size: 0.85em; + line-height: 1.25em; + /* margin: 0; /* <- full screen */ + /* margin: 0 1% 0 1%; /* <- with 1% of left and right margin */ + /* margin: 0 2% 0 2%; /* <- with 2% of left and right margin */ + margin: 0 4% 0 4%; /* <- with 4% of left and right margin */ + /* margin: 0 10% 0 10%; /* <- with 10% of left and right margin */ + } + +body { + background: #FFF; + border-width: 10px; + border-style: solid; + border-color: #FFF; + padding:0; + margin:0; + } + +/* Links */ + +a:link { text-decoration: none; color: #204C8D; } +a:hover { text-decoration: underline; color: green; } +a:active { text-decoration: underline; color: green; } +a:visited { text-decoration: none; color: #204C8D; } +a:visited:hover { text-decoration: underline; color: green; } +a.nonexistent, a.badinterwiki { color: gray; } + +/* Header */ + +#header { + margin:0; + padding-top: 1em; + background-color: #204C8D; + background-image: url("img/header-bg.png"); + line-height: 1.0em; + border:none; + } + +#header h1 { + color: #fff; + margin: 0; + line-height: 1.7em; + text-align: center; + margin-bottom: 0; +} + +#header p.description { + color: #fff; + text-align: center; + margin: 0; + font-size: 0.9em; + +} + +/* Sublinks */ + +.sublinks { + clear: both; + display: block; + margin: 0; + white-space: nowrap; + background: #EDF4FF; + font-size: 0.9em; + padding: 0.5em; + padding-left: 20px; + border-top: 1px solid #ddd; + border-bottom: 2px dotted #628ECA; + } + +.sublinks li { + display: inline; + padding: 0; + margin-right: 5px; + } + +.sublinks li.current { + font-weight: bold; +} + +.sublinks li:after { + margin-left: 5px; + content: " » "; + } + +.sublinks li:last-child:after { + content: ""; + } + + +/* Page */ + +#page { + padding-top: 1em; + padding-right: 20px; + padding-bottom: 0; + padding-left: 20px; + background: #FFF; +} + +dd span.description { + margin-left: 0.5em; +} + +.navibar { + /* Problem: clear: right; aligns nicely right of + * logo, but lets it float high in the header, + * disconnected from ground */ + clear: both; + display: block; + height: 20px; + padding: 0; + padding-left: 20px; + margin: 0; + font-size: 0.9em; + + /* For avoiding a gap between navibar and pageline + * on IE */ + zoom: 1; + } + +.navibar li { + display: inline; + white-space: nowrap; + padding-top: 5px; + padding-bottom: 5px; + border-width: 1px; + border-style: solid; + border-color: #628ECA; + background-color: #FFF; + background-image: url("img/navibartop-bg.png"); + background-position: left top; + background-repeat: repeat-x; + } + +.navibar li a { + /* To cover the box area as linkable */ + padding: 8px; + padding-top: 4px; + padding-bottom: 5px; + } + +.navibar a, .navibar a:visited { + color: #204C8D; + text-decoration: none; + } + +.navibar li.current a { + color: #FFFFFF; + text-decoration: none; + font-weight: bold; + } + +.navibar li:hover { + background-color: #628ECA; + background-image: url("img/navibartop-hover-bg.png"); + background-position: left top; + background-repeat: repeat-x; + } + +.navibar li:hover a { + color: #FFFFFF; + text-decoration: none; + } + +.navibar li.current, +.navibar li.current:hover, +.navibar li.current:hover a, +.navibar li.current:active a { + color: #FFFFFF; + background-color: #628ECA; + background-image: url("img/navibartop-hover-bg.png"); + background-position: left top; + background-repeat: repeat-x; + } + +/* Alignment */ + +.right { text-align: right; } +.left { text-align: left; } +.center { text-align: center; } + +.floatr { float:right; } +.floatl { float:left; } + +/* Lists */ + +dl { + clear: both; + } + +dt { + float: left;; + width: 200px; + padding-top: 3px; + padding-right: 1em; + text-align: right; + } + +/* Form */ + +textarea { + padding: 3px; + padding-left: 0.5em; +} + +/* Tables */ + +td { + font-size: 0.85em; + padding: 0.5em; + font-family: monospace; +} + +th { + padding: 0.5em; + font-size: 0.85em; + font-family: monospace; + background: #f8f8f8; +} + +#footer{ + background: #fafafa; + padding: 3px; + margin-top: 1em; +} + +/* Messages */ + +.lm { + background-color: #ECECEC; + background-image: url("img/moin-msg-bg-gray.png"); + width: -10px; + border-width: 1px; + border-style: solid; + border-color: #CFCFCF; + border-left-width: 4px; + padding: 1em !important; + } + +.lm.red { + border-color: #E0B7B7; + background-color: #FFECEC; + background-image: url("img/moin-msg-bg-red.png"); + } +.lm.green { + border-color: #D6F6D2; + background-color: #EEFFEC; + background-image: url("img/moin-msg-bg-green.png"); + } + +.lm.violet { + border-color: #F6D2F6; + background-color: #FFECFF; + background-image: url("img/moin-msg-bg-violet.png"); + } + +.lm.blue { + border-color: #D2E0F6; + background-color: #ECF4FF; + background-image: url("img/moin-msg-bg-blue.png"); + } + +.lm.orange { + border-color: #F6E7D2; + background-color: #FFF8EC; + background-image: url("img/moin-msg-bg-orange.png"); + } + +.message { + margin-left: 20%; + margin-right: 20%; + margin-bottom: 0.5em; + padding-top: 1em; + padding-bottom: 1em; + padding-left: 1.5em; + border-width: 0; + border-top-width: 4px; + border-top-style: solid; + border-bottom-width: 4px; + border-bottom-style: solid; + text-align: center; + font-weight: bold; + } + +/* Misc */ + +.pageline { + clear: both; + margin: 0; + padding: 0; + width: 100%; + /* sync these values, line-height is needed for IE */ + height: 5px; + line-height: 5px; + background: #628ECA; + } + +.action { + background: #f8f8f8; + padding: 1em; + margin-bottom: 0; + +} + +.action span { + margin-top: 5px; +} + +.action img { + vertical-align: top; + margin-right: 0.5em; + border: none; +} diff --git a/Scripts/Php/Webenv/admin/content.php b/Scripts/Php/Webenv/admin/content.php new file mode 100644 index 0000000..a2b05ca --- /dev/null +++ b/Scripts/Php/Webenv/admin/content.php @@ -0,0 +1,187 @@ + 'index.php') + { + echo '

Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

'; + exit; + } + +//-----------/* Sanitize URL variables */ + + foreach ( $_GET as $key => $value ) + { + if ( sanitize_url_var($key) ) + { + $url[$key] = $value; + } + } + +//----------/* Page Selector */ + + if ( isset( $url['page'] ) ) + { + switch ( $url['page'] ) + { + case 'entries': + /* Build relation between "Entries" sublinks and its pages */ + if ( isset($url['action'] ) ) + { + switch ( $url['action'] ) + { + case "add": + $page = 'p_entries_add.php'; + break; + + case "update": + $page = 'p_entries_update.php'; + break; + } + } + else + { + $page = 'p_entries.php'; + } + break; + + case 'pages': + // Just if user has admin rights. + if ( is_user('administrator') ) + { + /* Build relation between "Pages" sublinks and its pages */ + if ( isset($url['action'] ) ) + { + switch ( $url['action'] ) + { + case 'add': + $page = 'p_pages_add.php'; + break; + + case 'update': + $page = 'p_pages_update.php'; + break; + } + } + else + { + $page = 'p_pages.php'; + } + } + break; + + case 'categories': + // Just if user has admin rights. + if ( is_user('administrator') ) + { + /* Build relation between "Categories" sublinks and its pages */ + if ( isset($url['action'] ) ) + { + switch ( $url['action'] ) + { + case 'add': + $page = 'p_categories_add.php'; + break; + case 'update': + $page = 'p_categories_update.php'; + break; + case 'tree': + $page = 'p_categories_tree.php'; + break; + } + } + else + { + $page = 'p_categories.php'; + } + } + break; + + case 'comments': + // Just if user has admin rights. + if ( is_user('administrator') ) + { + /* Build relation between "Links" sublinks and its pages */ + if ( isset($url['action'] ) ) + { + switch ( $url['action'] ) + { + case 'add': + $page = 'p_comments_add.php'; + break; + case 'update': + $page = 'p_comments_update.php'; + break; + } + } + else + { + $page = 'p_comments.php'; + } + } + break; + + case 'links': + // Just if user has admin rights. + if ( is_user('administrator') ) + { + /* Build relation between "Links" sublinks and its pages */ + if ( isset($url['action'] ) ) + { + switch ( $url['action'] ) + { + case 'add': + $page = 'p_links_add.php'; + break; + } + } + else + { + $page = 'p_links.php'; + } + } + break; + + case 'users': + // Just if user has admin rights. + if ( is_user('administrator') ) + { + /* Build relation between "Links" sublinks and its pages */ + if ( isset($url['action'] ) ) + { + switch ( $url['action'] ) + { + case 'add': + $page = 'p_users_add.php'; + break; + } + } + else + { + $page = 'p_users.php'; + } + } + break; + + default: + $page = 'p_index.php'; + break; + } + } + else + { + $page = 'p_index.php'; + } + +//--------/* Verify file before include it + + if ( file_exists( ABSPATH . 'admin/' . $page ) ) + { + include (ABSPATH . 'admin/' . $page ); + } +?> diff --git a/Scripts/Php/Webenv/admin/footer.php b/Scripts/Php/Webenv/admin/footer.php new file mode 100644 index 0000000..8b06438 --- /dev/null +++ b/Scripts/Php/Webenv/admin/footer.php @@ -0,0 +1,35 @@ + 'index.php') + { + echo '

Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

'; + exit; + } +?> +
+ +
+ + + + + + diff --git a/Scripts/Php/Webenv/admin/header.php b/Scripts/Php/Webenv/admin/header.php new file mode 100644 index 0000000..6cbcc7a --- /dev/null +++ b/Scripts/Php/Webenv/admin/header.php @@ -0,0 +1,50 @@ + 'index.php') + { + echo '

Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

'; + exit; + } +?> + + + + + + Admin :: <?php echo HTML_TITLE ?> + + + + + + + +
+ +
+ diff --git a/Scripts/Php/Webenv/admin/img/header-background.png b/Scripts/Php/Webenv/admin/img/header-background.png new file mode 100755 index 0000000..ff2a7b0 Binary files /dev/null and b/Scripts/Php/Webenv/admin/img/header-background.png differ diff --git a/Scripts/Php/Webenv/admin/img/html-background.png b/Scripts/Php/Webenv/admin/img/html-background.png new file mode 100755 index 0000000..30f7d70 Binary files /dev/null and b/Scripts/Php/Webenv/admin/img/html-background.png differ diff --git a/Scripts/Php/Webenv/admin/img/moin-msg-bg-blue.png b/Scripts/Php/Webenv/admin/img/moin-msg-bg-blue.png new file mode 100755 index 0000000..7a816cf Binary files /dev/null and b/Scripts/Php/Webenv/admin/img/moin-msg-bg-blue.png differ diff --git a/Scripts/Php/Webenv/admin/img/moin-msg-bg-gray.png b/Scripts/Php/Webenv/admin/img/moin-msg-bg-gray.png new file mode 100755 index 0000000..43d1a55 Binary files /dev/null and b/Scripts/Php/Webenv/admin/img/moin-msg-bg-gray.png differ diff --git a/Scripts/Php/Webenv/admin/img/moin-msg-bg-green.png b/Scripts/Php/Webenv/admin/img/moin-msg-bg-green.png new file mode 100755 index 0000000..f4ca7ca Binary files /dev/null and b/Scripts/Php/Webenv/admin/img/moin-msg-bg-green.png differ diff --git a/Scripts/Php/Webenv/admin/img/moin-msg-bg-orange.png b/Scripts/Php/Webenv/admin/img/moin-msg-bg-orange.png new file mode 100755 index 0000000..25a57b5 Binary files /dev/null and b/Scripts/Php/Webenv/admin/img/moin-msg-bg-orange.png differ diff --git a/Scripts/Php/Webenv/admin/img/moin-msg-bg-red.png b/Scripts/Php/Webenv/admin/img/moin-msg-bg-red.png new file mode 100755 index 0000000..2dfcf09 Binary files /dev/null and b/Scripts/Php/Webenv/admin/img/moin-msg-bg-red.png differ diff --git a/Scripts/Php/Webenv/admin/img/moin-msg-bg-violet.png b/Scripts/Php/Webenv/admin/img/moin-msg-bg-violet.png new file mode 100755 index 0000000..657824d Binary files /dev/null and b/Scripts/Php/Webenv/admin/img/moin-msg-bg-violet.png differ diff --git a/Scripts/Php/Webenv/admin/img/ul.png b/Scripts/Php/Webenv/admin/img/ul.png new file mode 100755 index 0000000..fd89ccd Binary files /dev/null and b/Scripts/Php/Webenv/admin/img/ul.png differ diff --git a/Scripts/Php/Webenv/admin/img/ul2.png b/Scripts/Php/Webenv/admin/img/ul2.png new file mode 100644 index 0000000..467b107 Binary files /dev/null and b/Scripts/Php/Webenv/admin/img/ul2.png differ diff --git a/Scripts/Php/Webenv/admin/includes/classes/db_postgresql.php b/Scripts/Php/Webenv/admin/includes/classes/db_postgresql.php new file mode 100644 index 0000000..515493a --- /dev/null +++ b/Scripts/Php/Webenv/admin/includes/classes/db_postgresql.php @@ -0,0 +1,64 @@ + + * @copyright 2009 - CentOS Artwork SIG. + * @license GPL + */ + +class DB_PostgreSQL +{ + + var $dbconn; + +//---- Initialize class + + function __construct() + { + $conn_string = 'user=' . DB_USERNAME . ' password=' . DB_PASSWORD . ' dbname=' . DB_DBNAME; + $this->dbconn = pg_connect($conn_string) or die("Could not connect"); + } + +//---- Am I connected ? + + function check_connection() + { + if (pg_connection_status($this->dbconn) === PGSQL_CONNECTION_OK ) + { + return translate('connected'); + } + else + { + return translate('disconnected'); + } + + } + +//---- Query + + function query( $sql_string ) + { + $result = pg_query( $this->dbconn, $sql_string ); + + return $result; + } + +//---- Class Destructor + + function __destruct() + { + + if (pg_connection_status($this->dbconn)) + { + pg_close($this->dbconn); + } + + } + +} + +$db = new DB_PostgreSQL; +?> diff --git a/Scripts/Php/Webenv/admin/includes/classes/ldap.php b/Scripts/Php/Webenv/admin/includes/classes/ldap.php new file mode 100644 index 0000000..5fe83f3 --- /dev/null +++ b/Scripts/Php/Webenv/admin/includes/classes/ldap.php @@ -0,0 +1,572 @@ + + * @copyright 2009 - CentOS Artwork SIG. + * @license GPL + */ + +class LDAP +{ + + var $ldapconn; + var $ldapbind; + + // LDAP Filter Attributes + var $filter_attrb = array(); + var $filter_type = array(); + var $filter_clean = array(); + +//-----------/* Class initializations + + function __construct() + { + // Open connection against ldap server + $this->ldapconn = ldap_connect(LDAP_HOST,LDAP_PORT) or die("Could not connect to " . LDAP_HOST . "."); + + // Set protocol version to use + ldap_set_option($this->ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3) or die("Could not connect to server through LDAPv3."); + + // Bind + $this->ldapbind = ldap_bind( $this->ldapconn, LDAP_ROOTDN, LDAP_ROOTPW ); + + // Initialize ldap filter attributes + $this->filter_attrb['cn'] = 'cn'; + $this->filter_attrb['uid'] = 'uid'; + $this->filter_attrb['employeetype'] = ucfirst(translate('employeetype')); + $this->filter_attrb['preferredlanguage'] = ucfirst(translate('language')); + + // Initialize ldap filter Types + $this->filter_type['='] = '='; + $this->filter_type['~='] = '~='; + + // Initialize ldap filter default + $this->filter_clean['attrb'] = 'preferredlanguage'; + $this->filter_clean['type'] = '='; + $this->filter_clean['value'] = LANGUAGE; + } + +//----------- Get entries from ldap server + + function get_entries( $filter ) + { + // Return entries just if filter valid + $search = ldap_search($this->ldapconn,LDAP_DN,$filter); + $entries = ldap_get_entries($this->ldapconn,$search); + return $entries; + } + +//----------// Validate filter value input + // Sanitize filter pattern - Attributes + + function is_valid( $name , $value ) + { + switch ( $name ) + { + case 'uid': + $pattern = '/^([a-z0-9_]|\-|\.)+@(([a-z0-9_]|\-)+\.)+([a-z]{2,6})?$/'; + break; + + case 'preferredlanguage': + $pattern = '/^[a-zA-Z]{2}$/'; + break; + + case 'filtertype': + $pattern = '/^(=|~=)$/'; + break; + + case 'employeetype': + $pattern = '/^(writer|administrator)$/'; + break; + + default: + $pattern = '/^[a-zA-Z0-9_áéíóñúàçèé ]+$/'; + break; + } + + if ( isset( $pattern ) && preg_match( $pattern , $value )) + { + return true; + } + else + { + return false; + } + } + +//---------- Check filter attributes */ + + function sanitize_filter_attribute() + { + $dirty = array(); + $clean = array(); + + // Initialize dirty attribute + $dirty['attrb'] = $this->filter_clean['attrb']; + + // Initialize clean attribute + $clean['attrb'] = $this->filter_clean['attrb']; + + // Recover dirty attribute values from filter form + if ( isset( $_POST['attribute'] ) ) + { + $dirty['attrb'] = $_POST['attribute']; + } + + // Check dirty attribute + if ( array_key_exists( $dirty['attrb'], $this->filter_attrb ) ) + { + // Attribute is not dirty any more. It passed validation. + $clean['attrb'] = $dirty['attrb']; + } + + return $clean['attrb']; + } + +//---------- Check filter types + + function sanitize_filter_type() + { + $dirty = array(); + $clean = array(); + + $dirty['type'] = $this->filter_clean['type']; + $clear['type'] = $this->filter_clean['type']; + + // Recover dirty type values from filter form + if ( isset( $_POST['type'] ) ) + { + $dirty['type'] = $_POST['type']; + } + else + { + $dirty['type'] = $this->filter_clean['type']; + } + + // Check dirty types + if ( array_key_exists( $dirty['type'], $this->filter_type ) ) + { + // Type is not dirty any more. It passed validation. + $clean['type'] = $dirty['type']; + } + + return $clean['type']; + } + +//---------- Sanitize filter value + + function sanitize_filter_value() + { + $dirty = array(); + $clean = array(); + + $dirty['value'] = $this->filter_clean['value']; + $clean['value'] = $this->filter_clean['value']; + + // Recover dirty value from filter form + if ( isset( $_POST['value'] ) ) + { + $dirty['value'] = $_POST['value']; + } + + // Sanitize dirty value, based on supplied attribe + $name = $this->sanitize_filter_attribute(); + $value = $dirty['value']; + + if ( $this->is_valid( $name, $value ) ) + { + // Value is not dirty any more. It passed validation. + $clean['value'] = $value; + } + + return $clean['value']; + } + +//---------- Build ldap form filter + + function show_filter() + { + $clean = array(); + + $clean['attrb'] = $this->sanitize_filter_attribute(); + $clean['type'] = $this->sanitize_filter_type(); + $clean['value'] = $this->sanitize_filter_value(); + + // Start html form + $html = '
'; + $html .= '
'; + + // Build html form fileds. Start with some text + $html .= ucfirst(translate('filtering by')) . ': '; + + // Build attributes' select form field + $html .= get_user_attrSelector(); + + // Build types' select form field + $html .= ''; + + // Build value's text form field + $html .= ''; + + // Build submit form button + $html .= ''; + + // End html form + $html .= '
'; + $html .= '
'; + + return $html; + } + +//---------- Build ldap filter string + + function build_filter_string() + { + $clean['attrb'] = $this->sanitize_filter_attribute(); + $clean['type'] = $this->sanitize_filter_type(); + $clean['value'] = $this->sanitize_filter_value(); + + return $clean['attrb'] . $clean['type'] . $clean['value']; + + } + +//----------- Check uniqueness of uid attribute */ + + function is_uid_present( $uid ) + { + // Verify that uid entry's value be unique + $filter = 'uid=' . $uid; + $entry = $this->get_entries($filter); + + if ( $uid != '' && $entry['count'] == 1 ) + { + return true; + } + else + { + return false; + } + } + +//---------- Prepare userPassword + + function prepare_userpassword( $userpassword ) + { + $dirty['userpassword'] = $userpassword; + + switch ( LDAP_PASSHASH ) + { + case '{MD5}': + $clean['userpassword'] = LDAP_PASSHASH . base64_encode( pack( 'H*', md5( $dirty['userpassword'] ) ) ); + break; + + case '{SHA}': + $clean['userpassword'] = LDAP_PASSHASH . base64_encode( pack( 'H*', sha1( $dirty['userpassword'] ) ) ); + break; + } + + return $clean['userpassword']; + } + +//-----------/* Verify modifiable attributes + /* Description : Generally used to redifine entry's input keys and values, + /* based on is_valid() */ + /* $entry : is an array with entry's keys and values. */ + + function sanitize_entry( $entry ) + { + // Define attributes that can be modified + $fields = array('uid', 'cn','userpassword','displayname','preferredlanguage','employeetype'); + + // Verify and validate entry's attributes + foreach ( $fields as $key ) + { + if ( isset( $entry[$key] ) && $this->is_valid( $key, $entry[$key] ) ) + { + // Values that reach this point may be concider "clean". + $clean['entry'][$key] = $entry[$key]; + } + } + + // Return clean entry array or false + if ( isset( $clean['entry'] ) && is_array( $clean['entry'] ) ) + { + return $clean['entry']; + } + else + { + return false; + } + } + +//----------/* Initialize useradd values. + /* Description: Used in the useradd form page to initiate form values. + /* $attribute : is an array with the related attributes to check. */ + + function init_useradd_values( $attributes ) + { + foreach ( $attributes as $key ) + { + if ( ! isset( $_POST[$key] ) ) + { + $entry[$key] = ''; + } + else + { + if ( isset( $_POST[$key] ) && $this->is_valid($key, $_POST[$key]) ) + { + $entry[$key] = $_POST[$key]; + } + else + { + $entry[$key] = ''; + } + } + } + return $entry; + } + +//----------/* Initialize useradmin values and do action if submited + /* values are different from the actual one. + /* Description: used in the p_users.php to initiate form values. + /* $id : is the name of the form identification. + /* $attribute : is an array with the related attributes to check. */ + + function init_useradmin_values( $entry, $attributes, $action ) + { + + // First loop to match b in x[b] + for ($i = 0; $i < $entry['count']; $i++) + { + if ( isset( $_POST['uid'][$i] )) + { + // Define entry id + $entry_new['uid'] = $entry[$i]['uid'][0]; + + // Initialize entry cn + // Needed to update sn in the background. + $entry_new['cn'] = $entry[$i]['cn'][0]; + + // Second loop to match x in x[b] + foreach ( $attributes as $key ) + { + // Reset entry value based on input + if ( isset( $_POST[$key][$i] ) ) + { + // Check it is a valid value + if ( $this->is_valid( $key, $_POST[$key][$i] ) ) + { + // ... and that it is different from the actual one + if ( $_POST[$key][$i] != $entry[$i][$key][0] ) + { + + $entry_new[$key] = $_POST[$key][$i]; + + // Prepare userPassword. + // SECURITY: this attribute value should never + // be verified with the previous one. If + // verification is done you are providing a + // way to "guess" the user password by trying + // passwords until someone reject to update. + // Not to critic but if you guess it at the + // first try ;). Keep it unverifiable please. + if ( $key == 'userpassword' ) + { + $newpasswd = $this->prepare_userpassword($_POST[$key][$i]); + $entry_new[$key] = $newpasswd; + } + } + } + } + } + } + + // Do action if pressent + if ( isset( $entry_new ) ) + { + $message = $this->do_action( $entry_new, $action ); + } + else + { + $message = show_message(ucfirst(translate('nothing to do')), 'orange'); + } + } + + return $message; + } + +//-----------/* Do actions (udpate|delete|add) + /* $entry : is an array with the entry's key and value information. + /* $action : is an string telling what to do with the $entry. + /* Description : Actions are applied to just one entry at the same time. */ + /* The returned value is a message telling what happend with + the action requested.*/ + + function do_action( $entry, $action ) + { + // Define Entry's DN + if ( isset( $entry['uid'] ) && $this->is_valid( 'uid', $entry['uid'] ) ) + { + $dn = 'uid=' . $entry['uid'] . ',' . LDAP_DN; + } + else + { + $message = show_message(ucfirst(translate('a valid uid is required')),'orange'); + return $message; + } + + // Define possible actions + $possible_actions = '/^(add|update|delete)$/'; + if ( ! preg_match( $possible_actions, $action ) ) + { + // There is nothing to do here so exit to finish action intention. + $message = show_message(ucfirst(translate('invalid action')), 'red'); + return $message; + } + + // Define what to do in each action's case + switch ( $action ) + { + case 'update': + + // If there are valid values then do the update action. + if ( is_array( $entry ) ) + { + // Update sn attribute + $entry['sn'] = preg_replace('/^([a-zA-Z0-9_]+ ?)/','', $entry['cn']); + if ( $entry['sn'] == '' ) + { + $message = show_message(ucfirst(translate('invalid cn')), 'orange'); + return $message; + } + + if (ldap_modify($this->ldapconn, $dn, $entry)) + { + $message = show_message(ucfirst(translate('data was updated successfully')), 'green'); + } + else + { + $message = show_message(ucfirst(translate('data was not updated')), 'orange'); + } + } + break; + + // Delete Entry + case 'delete': + + // Delete Entry + if ( is_array( $entry ) ) + { + if ( ldap_delete( $this->ldapconn, $dn ) ) + { + $message = show_message(ucfirst(translate('data was deleted successfully')), 'green'); + } + else + { + $message = show_message(ucfirst(translate('data was not deleted')), 'orange'); + } + } + break; + + // Add Entry + case 'add': + + // Verify uid presence + if ( $this->is_uid_present( $entry['uid'] ) ) + { + // Abort this action commitment. + $message = show_message(ucfirst(translate('user identifier already exists')), 'orange'); + return $message; + } + + // Define and validate required attributes + $require_attrs = array('uid', 'userpassword', 'cn', 'displayname', 'preferredlanguage', 'employeetype'); + foreach ( $require_attrs as $key ) + { + if ( !isset($entry[$key]) || ! $this->is_valid($key, $entry[$key])) + { + $message = show_message(ucfirst(translate('the field')) .' '. translate($key) .' ' . translate('requires a valid value') , 'orange'); + return $message; + } + } + + // Prepare userPassword and other attributes. + $entry['userpassword'] = $this->prepare_userpassword($entry['userpassword']); + $entry['objectclass'] = 'inetOrgPerson'; + $entry['sn'] = preg_replace('/^([a-zA-Z0-9_]+ ?)/','', $entry['cn']); + if ( $entry['sn'] == '' ) + { + $message = show_message(ucfirst(translate('invalid cn')), 'orange'); + return $message; + } + $entry['mail'] = $entry['uid']; + + // If there are valid values then do the add action. + if ( ldap_add( $this->ldapconn, $dn, $entry ) ) + { + $message = show_message(ucfirst(translate('user added successfully')), 'green'); + } + else + { + $message = show_message(ucfirst(translate('user was not added')), 'orange'); + } + break; + } + + return $message; + } + +//-------------------/* Rename entry dn */ + + function rename_dn( $olddn, $newdn, $newparent, $deleteoldrdn ) + { + ldap_rename($this->ldapconn, $olddn, $newdn, $newparent, $deleteoldrdn ); + + return true; + } + +//-----------/* Display useradmin information + /* Description : Used in p_users.php + /* $entries : is an array with the entries' keys and values. */ + + function show_useradmin_info( $entries ) + { + $html = '
    '; + $html .= '
  • LDAP Host: ' . LDAP_HOST . '
  • '; + $html .= '
  • Domain Component (dc): ' . LDAP_DN . '
  • '; + $html .= '
  • ' . $this->show_filter() .'
  • '; + $html .= '
  • ' . ucfirst(translate('results')) . ': '. $entries['count']; '
  • '; + $html .= '
'; + + return $html; + } + +//-------------------/* Close connection */ + + function __destruct() + { + if ( isset( $this->ldapconn ) ) + { + ldap_unbind( $this->ldapconn ); + } + } + +} + +$ldap = new LDAP; +?> diff --git a/Scripts/Php/Webenv/admin/includes/functions/auth.php b/Scripts/Php/Webenv/admin/includes/functions/auth.php new file mode 100644 index 0000000..1b1279f --- /dev/null +++ b/Scripts/Php/Webenv/admin/includes/functions/auth.php @@ -0,0 +1,140 @@ + + * @copyright 2009 - CentOS Artwork SIG. + * @license GPL + */ + +//--------------Authentication stuff-------------- + + session_start(); + +//--------------/* Verify Admin access rights */ + + function check_adminaccess() + { + /* Verify session */ + if (!isset($_SESSION['employeetype'])) + { + header('Location: '. BASEURL .'admin/login.php'); + } + } + + /* Check User Access */ + function check_useraccess() + { + $timeout = 60 * 30; // In seconds, i.e. 30 minutes. + $fingerprint = md5($_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT']); + $redirect_to = BASEURL . 'admin/login.php?loggedout=true'; + + /* Destroy session if ... */ + if (isset($_SESSION['last_active']) && $_SESSION['last_active'] < (time()-$timeout) + || (isset($_SESSION['fingerprint']) && $_SESSION['fingerprint']!=$fingerprint) + || isset($_GET['action']) && $_GET['action'] == 'logout') + { + + setcookie(session_name(), '', time()-3600, '/'); + session_destroy(); + header("Location: $redirect_to"); + } + + /* Regenerate session */ + session_regenerate_id(); + + /* Increase session lifetime */ + $_SESSION['last_active'] = time(); + + /* Rebuild session fingerprint */ + $_SESSION['fingerprint'] = $fingerprint; + + } + + /* Verify username and password */ + function login() + { + require_once(ABSPATH . 'admin/includes/classes/ldap.php'); + $ldap = new LDAP; + + /* Inicialize variables */ + $login = array(); + $login['username'] = ''; + $login['password'] = ''; + + /* Validate username input */ + if (isset($_POST['username'])) + { + $mail_pattern = '/^([a-z0-9+_]|\-|\.)+@(([a-z0-9_]|\-)+\.)+[a-z]{2,6}$/'; + if (preg_match( $mail_pattern,$_POST['username'])) + { + $login['username'] = $_POST['username']; + } + } + + /* Validate password input */ + if (isset($_POST['password'])) + { + $login['password'] = $ldap->prepare_userpassword($_POST['password']); + } + + /* Query LDAP directory looking for username AND password */ + $search = $ldap->get_entries('(&(uid=' . $login['username'] . ')(&(userpassword=' . $login['password'] . ')))'); + + /* Build user's session if match */ + if ($search['count'] == 1) + { + /* Set session information */ + $_SESSION['uid'] = $search[0]['uid'][0]; + $_SESSION['cn'] = $search[0]['cn'][0]; + $_SESSION['employeetype'] = $search[0]['employeetype'][0]; + + /* Set session lasttime access */ + $_SESSION['last_active'] = time(); + + /* Set session fingerprint */ + $fingerprint = md5($_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT']); + $_SESSION['fingerprint'] = $fingerprint; + + /* Redirect to frontpage */ + header("Location: " . BASEURL); + + return 0; + } + else if ($search['count'] > 1) + { + // Login Failed: There are duplicates in the ldap directory database + return 002; + } + else + { + // Login Failed: There is no coincidece in the search + return '001'; + } + } + + // User links + function get_auth_userlinks() + { + + $html = '' . "\n"; + + return $html; + + } + +?> diff --git a/Scripts/Php/Webenv/admin/includes/functions/categories.php b/Scripts/Php/Webenv/admin/includes/functions/categories.php new file mode 100644 index 0000000..a6ebe11 --- /dev/null +++ b/Scripts/Php/Webenv/admin/includes/functions/categories.php @@ -0,0 +1,363 @@ +query( $sql_string ); + $category = pg_fetch_array($source); + + if ( ! $category['name'] ) + { + $category['name'] = 'No'; + } + } + + return $category['name']; +} + +//-------/* Get Admin Categories Selector + /* (used in category administration) */ + +function get_category_selector( $category_id = null, $category_parent_id = null, $type = 'insert' ) +{ + global $db; + + $sql_string = "SELECT id, name, parent FROM categories;"; + $rows = $db->query( $sql_string ); + + $html = ''; + + return $html; +} + +//-------/* Get Admin Categories Form + +function get_categories_admin_form( $rows ) +{ + $html = '
'; + $html .= '
'; + $html .= show_action_field('delete'); + $html .= ''; + $html .= '
'; + + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + + // Loop throuh rows + while ( $row = pg_fetch_array($rows) ) + { + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + } + + $html .= '
' . ucfirst(translate('name')) . '' . ucfirst(translate('parent category')) . '' . ucfirst(translate('description')) . '
'.$row['name'].''. get_category_name($row['id']) .''.$row['description'].'
'; + + $html .= '
'; + $html .= ''; + $html .= '
'; + $html .= '
'; + + return $html; +} + +//-------/* Get Add Categories Form + +function get_categories_add_form() +{ + $html = '
'; + $html .= '
'; + $html .= '
    '; + $html .= '
  • ' . translate('Name') . '
  • '; + $html .= '
  • '; + $html .= '
  • ' . ucfirst( translate('parent category') ) . '
  • '; + $html .= '
  • ' . get_category_selector() . '
  • '; + $html .= '
  • ' . translate('Description') . '
  • '; + $html .= '
  • '; + $html .= '
  • '; + $html .= '
'; + $html .= ''; + $html .= '
'; + $html .= '
'; + + return $html; +} + +//-------/* Get Update Categories Form + +function get_categories_update_form() +{ + global $db; + + if ( sanitize_url_var( 'id' ) ) + { + $clean['id'] = $_GET['id']; + $sql_string = "SELECT id, name, parent, description FROM categories WHERE id=" . $clean['id'] . ";"; + $row = $db->query( $sql_string ); + + if ( $row !== false ) + { + $row = pg_fetch_array($row); + + $html = '
'; + $html .= '
'; + $html .= '
    '; + $html .= '
  • ' . translate('Name') . '
  • '; + $html .= '
  • '; + $html .= '
  • ' . ucfirst(translate('parent category')) . '
  • '; + $html .= '
  • '. get_category_selector( $row['id'], $row['parent'], 'update').'
  • '; + $html .= '
  • ' . translate('Description') . '
  • '; + $html .= '
  • '; + $html .= '
  • '; + $html .= '
'; + $html .= ''; + $html .= '
'; + $html .= '
'; + } + else + { + $html = show_message( ucfirst( translate("the category doesn't exist") ) , 'orange'); + } + } + else + { + $html = show_message( ucfirst( translate('nothing to do') ) , 'orange'); + } + + return $html; +} + +//-------/* Administrate Categories + +function admin_categories() +{ + global $db; + + $fields = array('id', 'name', 'parent', 'description'); + $counter = 0; + + // Define action to do + if (isset($_POST['action']) && preg_match('/^(update|delete|add)$/', $_POST['action'])) + { + $action = $_POST['action']; + + switch ( $action ) + { + case 'update': + + // Initialize FORM variables + foreach ( $fields as $key ) + { + if ( isset( $_POST[$key] ) && $_POST[$key] != '' ) + { + $clean[$key] = pg_escape_string($_POST[$key]); + } + else + { + $clean[$key] = ''; + } + } + + + // Required fields + if ( $clean['name'] == '' ) + { + $message = show_message(ucfirst(translate('field name can not be empty')),'orange'); + return $message; + } + + // Verify and redifine category indentification + if ( sanitize_url_var( 'id' ) ) + { + $clean['id'] = $_GET['id']; + } + + + // Build sql string for updating + $sql_string = "UPDATE categories SET name='" . $clean['name'] . "', description='" . $clean['description'] . "' WHERE id=" . $clean['id'] . ";"; +echo $sql_string; + // Execute UPDATE action + $db->query( $sql_string ); + + // Define message for successful action + $message = show_message( ucfirst( translate('data was updated successfully' ) ), 'green'); + + break; + + case 'delete': + + if ( isset( $_POST['id'] ) ) + { + foreach ( $_POST['id'] as $key ) + { + if ( preg_match( '/^[0-9]+$/', $key ) ) + { + // Check for dependencies for actual category id + // ... + + // Build SQL string for deleting + $sql_string = "DELETE FROM categories WHERE id=" . $key . ";"; + + // Execute DELETE action + if ( $db->query( $sql_string ) ) + { + $counter++; + } + } + else + { + // Build message for failed action + $message = show_message(ucfirst(translate('id value is incorrect'))); + return $message; + } + } + + // Build message for successful action (with plural distinction) + if ( $counter > 1 ) + { + $message = $counter . ' ' . translate('records deleted successfully'); + } + else + { + $message = $counter . ' ' . translate('record deleted successfully'); + } + $message = show_message( $message, 'green'); + } + break; + + case 'add': + + $fields = array('name', 'parent', 'description'); + + // Initialize and prepare input values for db insertion + foreach ( $fields as $key) + { + if ( isset( $_POST[$key] ) ) + { + $clean[$key] = pg_escape_string($_POST[$key]); + } + else + { + $clean[$key] = ''; + } + } + + // Required fields + if ( $clean['name'] == '' ) + { + $message = show_message(ucfirst(translate('field name can not be empty')),'orange'); + return $message; + } + + // Build sql string for inserting + $sql_string = "INSERT INTO categories (name, parent, description) + VALUES ('".$clean['name']."', '" . $clean['parent']. "', '" .$clean['description']."');"; + + // Execute INSERT action + if ( $db->query( $sql_string ) ) + { + // Build message for successful action + $message = show_message(ucfirst(translate('category was added successfully')),'green'); + } + else + { + // Build message for failed action + $message = show_message(ucfirst(translate('category was not added')),'orange'); + } + break; + } + + // Define default informative message if no action is present + if ( ! isset( $message ) ) + { + $message = show_message(ucfirst(translate('nothing to do')), 'orange'); + } + + // Return informative action message + return $message; + + } + + // Return false if no action is present + return false; +} + + +//--------/* Get Category Tree */ + +function get_category_tree( $parent = 0, $linkto = 'default' ) +{ + + global $db; + $sql_string = "SELECT id, name, parent FROM categories WHERE parent = ". $parent ." ORDER BY name;"; + $categories = $db->query($sql_string); + $html = ''; + + $html .= '
    '; + while ( $row = pg_fetch_array($categories) ) + { + switch ( $linkto ) + { + case 'admin': + $html .= '
  • ' . $row['name'] . '
  • '; + break; + + default: + $html .= '
  • ' . $row['name'] . '
  • '; + break; + + } + $html .= get_category_tree( $row['id'] , $linkto ); + } + $html .= '
'; + + return $html; +} diff --git a/Scripts/Php/Webenv/admin/includes/functions/html.php b/Scripts/Php/Webenv/admin/includes/functions/html.php new file mode 100644 index 0000000..187fad5 --- /dev/null +++ b/Scripts/Php/Webenv/admin/includes/functions/html.php @@ -0,0 +1,47 @@ +'; + $html .= $message; + $html .= '
'; + + return $html; + } + +//-------/* Show action selector form field + + function show_action_field( $action = 'default' ) + { + $html = ucfirst(translate('action')) . ': '; + + return $html; + + } +?> diff --git a/Scripts/Php/Webenv/admin/includes/functions/links.php b/Scripts/Php/Webenv/admin/includes/functions/links.php new file mode 100644 index 0000000..5546d8f --- /dev/null +++ b/Scripts/Php/Webenv/admin/includes/functions/links.php @@ -0,0 +1,165 @@ +'; + + if ( isset($url['page'] ) ) + { + $html .= '
  • '. strtoupper(translate('home')) . '
  • '; + } + else + { + $html .= '
  • '. strtoupper(translate('home')) . '
  • '; + } + + foreach ($link as $key => $value) + { + if ( isset($url['page']) && $url['page'] == $key) + { + $value = translate(strtolower($key)); + $html .= '
  • ' . strtoupper($value). '
  • '; + } + else + { + $value = translate(strtolower($key)); + $html .= '
  • ' . strtoupper($value). '
  • '; + } + } + + $html .= ''; + + return $html; + } + +/*** + * Sublinks used in the administratoristration interface + * + * @param show_sublink(); + * @param control link visibility/availability. + */ + +function show_sublinks() +{ + +//-----------/* Initialize Link Array */ + + $link = array(); + + $link['entries'] = ucfirst(translate('entries')); + $link['pages'] = ucfirst(translate('pages')); + $link['categories'] = ucfirst(translate('categories')); + $link['links'] = ucfirst(translate('links')); + $link['users'] = ucfirst(translate('users')); + +//-----------/* Sanitize URL variables */ + + if ( sanitize_url_var('page') ) + { + $url['page'] = $_GET['page']; + } + +//-----------/* Build html links */ + + $html = ''; + + return $html; + } +?> diff --git a/Scripts/Php/Webenv/admin/includes/functions/url.php b/Scripts/Php/Webenv/admin/includes/functions/url.php new file mode 100644 index 0000000..570f521 --- /dev/null +++ b/Scripts/Php/Webenv/admin/includes/functions/url.php @@ -0,0 +1,53 @@ + diff --git a/Scripts/Php/Webenv/admin/includes/functions/users.php b/Scripts/Php/Webenv/admin/includes/functions/users.php new file mode 100644 index 0000000..78abe8f --- /dev/null +++ b/Scripts/Php/Webenv/admin/includes/functions/users.php @@ -0,0 +1,189 @@ + 'English', + 'es' => 'Español', + 'fr' => 'Français'); + + return $languages; + } + +//---------------------/* Determine user's role */ + + function is_user( $role ) + { + if ( $_SESSION['employeetype'] == $role ) + { + return true; + } + else + { + return false; + } + } + +//---------------------/* User Role-Selector */ + +function get_user_roleSelector( $id = '', $entry_value = '' ) +{ + $employeetypes = get_user_roles(); + + if ( ! is_int($id) ) + { + $html = ''; + } + + foreach ($employeetypes as $value ) + { + if ( $entry_value <> '' && $value == $entry_value ) + { + $html .= ''; + } + else + { + $html .= ''; + } + } + + $html .= ''; + + return $html; +} + +//---------------------/* User Attribute-Selector */ + +function get_user_attrSelector( $attr = '/(uid|cn|preferredlanguage|employeetype)/' ) +{ + global $ldap; + + $clean['attrb'] = $ldap->sanitize_filter_attribute(); + + $attributes = get_user_attributes(); + + $html = ''; + + return $html; +} + +//---------------------/* User Language-Selector */ + +function get_user_langSelector( $id = '', $entry_value = '' ) +{ + $languages = get_user_languages(); + + if ( isset($id) && is_int($id) ) + { + $html = ''; + } + + foreach ($languages as $key => $value ) + { + if ( ( $entry_value <> '' && $key == $entry_value ) || ( $id == '' && $entry_value == '' && $key == LANGUAGE ) ) + { + $html .= ''; + } + else + { + $html .= ''; + } + } + + $html .= ''; + + return $html; +} + +//-------/* Build useradd's form */ + +function show_useradd_form( $entry ) +{ + $html = '
    '; + $html .= '
    '; + + $html .= '
      '; + $html .= '
    • ' . ucfirst(translate('uid')) .':
    • '; + $html .= '
    • ' . ucfirst(translate('ex')) . '. john@example.com
    • '; + $html .= '
    • ' . ucfirst(translate('password')) . ':
    • '; + $html .= '
    • '; + $html .= '
    • '. ucfirst(translate('cn')) . ':
    • '; + $html .= '
    • '; + $html .= '
    • '. ucfirst(translate('displayname')) . ':
    • '; + $html .= '
    • '; + $html .= '
    • '. ucfirst(translate('preferredlanguage')) . ':
    • '; + $html .= '
    • ' . get_user_langSelector() . '
    • '; + $html .= '
    • ' . ucfirst(translate('employeetype')) . ':
    • '; + $html .= '
    • '. get_user_roleSelector() . '
    • '; + $html .= '
    • '; + $html .= '
    '; + + $html .= '
    '; + $html .= '
    '; + + return $html; +} + +//-------/* Show useradmin form + + function show_useradmin_form() + { + + + + } + +?> diff --git a/Scripts/Php/Webenv/admin/index.php b/Scripts/Php/Webenv/admin/index.php new file mode 100644 index 0000000..2f8814f --- /dev/null +++ b/Scripts/Php/Webenv/admin/index.php @@ -0,0 +1,25 @@ + diff --git a/Scripts/Php/Webenv/admin/login.php b/Scripts/Php/Webenv/admin/login.php new file mode 100644 index 0000000..1a90302 --- /dev/null +++ b/Scripts/Php/Webenv/admin/login.php @@ -0,0 +1,107 @@ + 0) + { + $message = '
    ' . ucfirst(translate($message)) . '
    '; + } + else + { + header('Location: index.php'); + } +} +?> + + + + + Admin :: <?php echo HTML_TITLE ?> + + + + + + + + + +
    + +
    + +

    + + '') {; echo $message; } ?> + +
    + + + + + + + + + + + + + +
    : (. john@example.com)
    :
    +
    + +
    +
    + + + + + + diff --git a/Scripts/Php/Webenv/admin/p_categories.php b/Scripts/Php/Webenv/admin/p_categories.php new file mode 100644 index 0000000..f6ef325 --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_categories.php @@ -0,0 +1,34 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } + +//----- Admin categories + + $message = admin_categories(); + +//----- Get Row + + $sql_string = "SELECT id, name, parent, description FROM categories ORDER BY name;"; + $rows = $db->query( $sql_string ); + +//----- Show action results + + if ( isset( $message ) ) + { + echo $message; + } +?> + + + +

    + +
    + +
    diff --git a/Scripts/Php/Webenv/admin/p_categories_add.php b/Scripts/Php/Webenv/admin/p_categories_add.php new file mode 100644 index 0000000..011261e --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_categories_add.php @@ -0,0 +1,26 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } + +//---- Do action and grab results + + if (isset($_POST['action'])) + { + $message = admin_categories(); + if (isset($message)) + { + echo $message; + } + } + +?> + +

    + + diff --git a/Scripts/Php/Webenv/admin/p_categories_tree.php b/Scripts/Php/Webenv/admin/p_categories_tree.php new file mode 100644 index 0000000..9745922 --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_categories_tree.php @@ -0,0 +1,15 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } + +?> + +

    + + diff --git a/Scripts/Php/Webenv/admin/p_categories_update.php b/Scripts/Php/Webenv/admin/p_categories_update.php new file mode 100644 index 0000000..77012ce --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_categories_update.php @@ -0,0 +1,26 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } + +//---- Do action and grab results + + if (isset($_POST['action'])) + { + $message = admin_categories(); + if (isset($message)) + { + echo $message; + } + } + +?> + +

    + + diff --git a/Scripts/Php/Webenv/admin/p_comments.php b/Scripts/Php/Webenv/admin/p_comments.php new file mode 100644 index 0000000..89270dc --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_comments.php @@ -0,0 +1,30 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } + +//----- Admin categories + + +//----- Get Row + + +//----- Show action results + + if ( isset( $message ) ) + { + echo $message; + } +?> + + + +

    + +
    +
    diff --git a/Scripts/Php/Webenv/admin/p_entries.php b/Scripts/Php/Webenv/admin/p_entries.php new file mode 100644 index 0000000..be30f7b --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_entries.php @@ -0,0 +1,11 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } +?> +

    diff --git a/Scripts/Php/Webenv/admin/p_entries_add.php b/Scripts/Php/Webenv/admin/p_entries_add.php new file mode 100644 index 0000000..dd9ab86 --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_entries_add.php @@ -0,0 +1,11 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } +?> +

    diff --git a/Scripts/Php/Webenv/admin/p_entries_update.php b/Scripts/Php/Webenv/admin/p_entries_update.php new file mode 100644 index 0000000..ae7d74f --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_entries_update.php @@ -0,0 +1,11 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } +?> +

    diff --git a/Scripts/Php/Webenv/admin/p_index.php b/Scripts/Php/Webenv/admin/p_index.php new file mode 100644 index 0000000..c609f84 --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_index.php @@ -0,0 +1,17 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } +?> +

    + + +

    + +

    Database Status: check_connection();?>

    +

    diff --git a/Scripts/Php/Webenv/admin/p_links.php b/Scripts/Php/Webenv/admin/p_links.php new file mode 100644 index 0000000..f0a3144 --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_links.php @@ -0,0 +1,11 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } +?> +

    diff --git a/Scripts/Php/Webenv/admin/p_links_add.php b/Scripts/Php/Webenv/admin/p_links_add.php new file mode 100644 index 0000000..bbdad5d --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_links_add.php @@ -0,0 +1,11 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } +?> +

    diff --git a/Scripts/Php/Webenv/admin/p_pages.php b/Scripts/Php/Webenv/admin/p_pages.php new file mode 100644 index 0000000..0266e00 --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_pages.php @@ -0,0 +1,11 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } +?> +

    diff --git a/Scripts/Php/Webenv/admin/p_pages_add.php b/Scripts/Php/Webenv/admin/p_pages_add.php new file mode 100644 index 0000000..9c5b616 --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_pages_add.php @@ -0,0 +1,11 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } +?> +

    diff --git a/Scripts/Php/Webenv/admin/p_pages_update.php b/Scripts/Php/Webenv/admin/p_pages_update.php new file mode 100644 index 0000000..11f1c32 --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_pages_update.php @@ -0,0 +1,12 @@ + 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } +?> + +

    diff --git a/Scripts/Php/Webenv/admin/p_users.php b/Scripts/Php/Webenv/admin/p_users.php new file mode 100644 index 0000000..2a37577 --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_users.php @@ -0,0 +1,134 @@ + + * Released under GPL lisence (http://www.fsf.org/licensing/licenses/gpl.txt) + */ + + +//-------------/* Show error if this page is called directly. + + if ( basename($_SERVER['PHP_SELF']) <> 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } + +//------------|* Define filter. + + $filter = $ldap->build_filter_string(); + +/*------------|* Initialize entry values. */ + + $entries = $ldap->get_entries( $filter ); + +/*------------|* Do Action if POST + * + * Description : Actions take place entry by entry. Just one + * entry at the same time. Actually two actions are supported + * (update,delete). */ + + if ( isset( $_POST['useradmin'] ) ) + { + // Define useradmin attributes. + $fields = array('cn', 'userpassword', 'displayname', 'preferredlanguage', 'employeetype'); + + // Recover action to do. + $action = $_POST['action']; + + // Reinitialize entries values based on input and do action if present + $message = $ldap->init_useradmin_values( $entries, $fields, $action ); + + + // Reload entry value to reflect changes immediately + $entries = $ldap->get_entries( $filter ); + } + +//------------/* Display useradmin action results + + if ( isset( $message ) ) + { + echo $message; + } + +//------------/* Display useradmin title + + echo '

    ' . ucfirst(translate(strtolower('admin'))) . ' ' . translate(strtolower('users')) . '

    '; + +//------------/* Display useradmin form + +?> + +
    + +

    show_useradmin_info( $entries ) ?>

    + +
    + +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + +
    + + + +
    + +
    diff --git a/Scripts/Php/Webenv/admin/p_users_add.php b/Scripts/Php/Webenv/admin/p_users_add.php new file mode 100644 index 0000000..ff49658 --- /dev/null +++ b/Scripts/Php/Webenv/admin/p_users_add.php @@ -0,0 +1,49 @@ + + * Released under GPL lisence (http://www.fsf.org/licensing/licenses/gpl.txt) + */ + +//------------/* Show error if this page is called directly. + + if ( basename($_SERVER['PHP_SELF']) <> 'index.php') + { + echo '

    Sorry, this page can\'t be served directly. '; + echo 'Try this instead.

    '; + exit; + } + +//------------/* Initialize entry values. + + $fields = array('uid', 'userpassword', 'cn', 'employeetype', 'preferredlanguage', 'displayname'); + $entry = $ldap->init_useradd_values( $fields ); + +//------------/* Do Action if POST + + if ( isset( $_POST['useradd'] ) ) + { + $message = $ldap->do_action( $entry, 'add' ); + } + +//------------/* Display useradd action results + + if ( isset($message) ) + { + echo $message; + } + +//------------/* Display useradd title + + echo '

    ' . ucfirst(translate('add')) . ' ' . translate('user') . '

    '; + +//------------/* Display useradd form + + echo show_useradd_form( $entry ); + +?> diff --git a/Scripts/Php/Webenv/admin/style.css b/Scripts/Php/Webenv/admin/style.css new file mode 100644 index 0000000..a99e426 --- /dev/null +++ b/Scripts/Php/Webenv/admin/style.css @@ -0,0 +1,662 @@ +/*** + * Style used in some server responses. + * + * -- CentOS Artwork SIG. + * http://projects.centos.org/trac/artwork/wiki/WebServerCustomization + */ + +html { + background-color: #FFF; + background-image: url(img/html-background.png); + font-family: "DejaVu Sans", "Liberation Sans", sans-serif; + font-size: 0.85em; + line-height: 1.25em; + margin: 0 4% 0 4%; /* <- with 4% of left and right margin */ + } + +body { + background: #FFF; + border-width: 10px; + border-style: solid; + border-color: #FFF; + padding:0; + margin: 0; + } + +/* RSS */ + +#header .rss { + float:right; + padding: 0; + margin: 0; + margin-right: 1em; + border: none; +} + +/* Links */ + +a:link { text-decoration: none; color: #204C8D } +a:hover { text-decoration: underline; color: green; } +a:active { text-decoration: underline; color: green; } +a:visited { text-decoration: none; color: #204C8D; } +a:visited:hover { text-decoration: underline; color: green; } + +#footer .credits a:link { border-bottom: 1px dotted #eee; text-decoration: none; color: #eee } +#footer .credits a:hover { border-bottom: 1px dotted #eee; text-decoration: underline; color: #fff; } +#footer .credits a:active { border-bottom: 1px dotted #eee; text-decoration: underline; color: #eee; } +#footer .credits a:visited { border-bottom: 1px dotted #eee; text-decoration: none; color: #eee; } +#footer .credits a:visited:hover { border-bottom: 1px dotted #eee; text-decoration: underline; color: #fff; } + +#header .adminlinks a:link { border-bottom: 1px dotted #eee; text-decoration: none; color: #eee } +#header .adminlinks a:hover { border-bottom: 1px dotted #eee; text-decoration: underline; color: #fff; } +#header .adminlinks a:active { border-bottom: 1px dotted #eee; text-decoration: underline; color: #eee; } +#header .adminlinks a:visited { border-bottom: 1px dotted #eee; text-decoration: none; color: #eee; } +#header .adminlinks a:visited:hover { border-bottom: 1px dotted #eee; text-decoration: underline; color: #fff; } + +/* Alignment */ + +.floatr { float: right; } +.floatl { float: left; } +.alignr { text-align: right; } +.alignl { text-align: left; } +.alignc { text-align: center; } + +/* Lists */ + +#content ul, +#content ol { + padding-left: 1.9em; + margin-left: 3em; + margin-bottom: 1em; + } + +#content ul { + list-style: url("img/ul.png") circle; + } + +#content ol { + list-style-image: none !important; + } + +#content ul li { + padding-left: 0em; + margin-bottom: 0.3em; + } + +#content ol li { + padding-left: 0em; + margin-bottom: 0.3em; + } + +#content ul ul, +#content ul ol, +#content ol ul, +#content ol ol { + margin-left: 0.5em; + margin-top: 0.3em; + } + +#content ul li p, +#content ol li p { + margin-bottom: 0.3em; + line-height: 1.5em; + margin-left: 0 !important; + } + +/* Tables */ + +#content table { + margin: 0; + margin-top: 0.5em; + margin-bottom: 0.5em; + border-collapse: collapse; + clear: both; + border-width: 1px; + border-style: solid; + border-color: #EDEDED; + width: 100%; + } + +#content th { + background: #f8f8f8; + padding: 0.5em; + border-width: 1px; + border-style: solid; + border-color: #CCC; + } + +#content th.firstcol { + width: 1%; +} + +#content td { + border-width: 1px; + border-style: solid; + border-color: #CCC; + padding: 0.5em; + } + + +/* Presentation */ + +#header { + background-color: #204C8D; + background-image: url(img/header-background.png); + color: #fff; + } + +#header div.people_info { + float: right; + padding: 0.3em 10% 1.2em 1.2em; + padding-right: 10%; + text-align: center; + } + +#header .adminlinks { + float:right; + margin: 0.5em; + text-align: right; + font-size: 0.8em; + color: #eee; +} + +#logo { + color: #fff; + padding: 10px; + width: 500px; + } + +#logo img { + border: none; +} + +#logo .logo_text{ + font-size: 1.7em; + color: #fff; + margin-top: -50px; + float:left; + margin-left: 260px; + text-align:left; +} + +/* Ads */ + +.googlecontent { + clear: right; + margin: 0; +} + +/* Page lines */ + +.pageline_dark { + border: 1px solid #31629b; + clear: both; + margin:0; + padding:0; +} + +.pageline { + border-bottom:2px solid #cad9ee; + clear: both; + margin:0; + padding:0; +} + +.pageline_soft { + border: 1px solid #fff; + clear: both; + margin:0; + padding:0; +} + +/* Mainlinks */ + +.mainlinks { + display: block; + padding: 0; + padding-left: 20px; + margin: 0; + font-size: 0.8em; + background-color: #2b4f80; + height: 23px; + border-bottom: 2px solid #6fa4df; + } + +.mainlinks li { + float: left; + display: inline; + white-space: nowrap; + font-weight: bold; + padding:0; + padding-top:3px; + padding-bottom:3px; + } + +.mainlinks li a { + /* To cover the box area as linkable */ + padding: 10px; + padding-top: 4px; + padding-bottom: 4px; + border-right: 1px solid #25456f; + border-left: 1px solid #31629b; + } + +.mainlinks a, +.mainlinks a:visited { + color: #BDD3FB; + text-decoration: none; + } + +.mainlinks li.current a { + color: #25456f; + border-right: 1px solid #fff; + border-left: 1px solid #fff; + text-decoration: none; + } + +.mainlinks li:hover { + background-color: #436595; + padding-bottom: 3px; + } + +.mainlinks li:hover a { + color: #BDD3FB; + text-decoration: none; + } + +.mainlinks li:hover a:active { color:#BDD3FB; background-color:#436595; text-decoration:none;} +.mainlinks li a:active { color:#BDD3FB; background-color:#436595; text-decoration:none;} + +.mainlinks li.current, +.mainlinks li.current:hover, +.mainlinks li.current:hover a, +.mainlinks li.current:active a { + color: #25456f; + background: #f6f9ff; + padding-bottom: 5px; + } + +/* Sublinks */ + +.sublinks { + display: block; + margin:0; + padding: 0.8em; + white-space: nowrap; + background: #f6f9ff; + border-bottom:2px solid #cad9ee; + color: #000; + } +.sublinks ul { + margin: 0; + padding: 0; +} +.sublinks li { + display: inline; + border-right: 1px dotted #6fa4df; + padding-left:0.8em; + padding-right:0.8em; + } + +.sublinks li:last-child { + border-right: none; +} + +/* Entries pager */ + +#content .entrypager { + border-top: 1px solid #f8f8f8; + padding-top: 10px; + clear: both; +} + +#content .entrypager span { + display: inline; + font-size: 0.9em; +} + +/* Content */ + +#content .columnl { + display: block; + background-color: #fff; + margin: 0; + padding-right: 20px; + padding-left: 20px; + padding-bottom: 2em; + } + +#content .columnr div.center { text-align: center; } + +#content .columnr div.last { + border-top: 1px solid #fff; + border-bottom: none; +} + +#content .columnr p.first { + border-top: none; +} + +#content h1 { + color: #333; + line-height: 1em; + margin: 0px; + margin-bottom: 1em; + margin-top: 1em; + padding: 0px; +} + +#content h2, +#content h3, +#content h4, +#content h5, +#content h6 { + color: #333; + line-height: 0.7em; + margin: 0px; + margin-bottom: 1em; + padding: 0px; + } + +#content tt { + font-family: "DejaVu Sans Mono", "Liberation Sans Mono", monospace; +} + +#content { + clear:both; + padding-left:0px; + padding-right:0px; +} + +#content p { + color: #333; + line-height: 1.5em; + margin: 0; + padding: 0; + margin-bottom: 1em; + margin-top: 1em; +} + +#content pre { + font-size: 1.4em; + border-width: 1px; + border-style: solid; + border-color: #E5E5E5; + border-left-width: 4px; + white-space: pre; + background: #FFFAE9; + overflow: auto; + padding: 1em; +} + +#content hr { + margin-top: 1em; + margin-bottom: 1em; + padding: 0; + border: 1px solid #f8f8f8; + } + +.promoblock { + display: block; + float:left; + padding: 0; + padding-left: 1em; + padding-right: 0.5em; + margin-top: 0.5em; + margin-bottom: 0.5em; + border-left: 2px dotted #cad9ee; + height: 200px; + font-size: 0.8em; +} + +.promoblock p { + padding: 0em; + line-height: 1.5em; + margin: 0em; + margin-bottom: 1em; +} + +.promoblock.col1, +.promoblock.col2, +.promoblock.col3 { width: 20%;} +.promoblock.col4 { width: 30%; } + +.promoblock.first { border-left: none;} + +#content div.post p.info { + font-size: 0.8em; + margin-top: -1em !important; +} + +#content div.post.first p.info { + margin-top: -2em !important; +} + +#content .post { + margin-top: 1em; + padding-top: 1em; +} + +#content .post.first { + border-bottom: 1px solid #f8f8f8; +} + + +#content .post.first h2 { + font-size: 2em; +} + +/* Content - Forms */ + +#content form { + margin: 0; + padding: 0; + display: inline; +} + +div.formfields { + border-top: 1px solid #f8f8f8; + border-bottom: 1px solid #f8f8f8; +} + +div.formfields ul { + margin-left: 0px !important; + padding-left: 0px !important; +} + +div.formfields li { + + list-style: none; +} + +div.formfields li.description { + font-weight: bold; + text-align: right; + width: 180px; + padding-top: 5px; +} + +div.formfields li.value { + margin-left: 190px; + margin-top: -25px; +} + +div.formfields li.submit { + margin-top: 25px; + margin-left: 190px; +} + +#header input[type="submit"], +#header input[type="text"] { + border-width: 2px; + border-style: solid; + border-color: #204C8D; + background-color: #3B71B8; + color: #FFFFFF; + display: inline; + text-decoration: none; + padding: 1px; + padding-left: 4px; + padding-right: 4px; + } + +#header input[type="submit"] { + font-weight: bold; + cursor: pointer; + font-size: 0.8em; +} + +#header input[type="text"] { + font-size: 0.85em; + display: inline; + padding: 2px; + padding-left: 4px; + border: 2px solid #204C8D; + background-color: #EDF4FF; + color: #204C8D; + width: 130px; +} +#header select { + font-size: 0.8em; + border-width: 2px; + border-style: solid; + border-color: #204C8D; + background-color: #3B71B8; + color: #FFFFFF; + cursor: pointer; + display: inline; + font-weight: bold; + text-decoration: none; + padding: 1px; + } + +.input { + /* does strange effect to button (text size becomes bigger when clicking) + font-size: 1em; + font-family: Arial, Lucida Grande, sans-serif; + */ + } + +textarea { + font-size: 1em; + font-family: "DejaVu Sans Mono", "Liberation Mono", monospace; + } + +.disabled { + color: gray; + } + +/* Admonitions */ + +.lm { + background-color: #ECECEC; + background-image: url("img/moin-msg-bg-gray.png"); + width: -10px; + border-width: 1px; + border-style: solid; + border-color: #CFCFCF; + border-left-width: 4px; + padding: 1em !important; + } + +.lm.red { + border-color: #E0B7B7; + background-color: #FFECEC; + background-image: url("img/moin-msg-bg-red.png"); + } + +.lm.green { + border-color: #D6F6D2; + background-color: #EEFFEC; + background-image: url("img/moin-msg-bg-green.png"); + } + +.lm.violet { + border-color: #F6D2F6; + background-color: #FFECFF; + background-image: url("img/moin-msg-bg-violet.png"); + } + +.lm.blue { + border-color: #D2E0F6; + background-color: #ECF4FF; + background-image: url("img/moin-msg-bg-blue.png"); + } + +.lm.orange { + border-color: #F6E7D2; + background-color: #FFF8EC; + background-image: url("img/moin-msg-bg-orange.png"); + } + +.message { + margin-top: 2em; + margin-right: 20%; + margin-bottom: 2em; + margin-left: 20%; + padding-top: 1em; + padding-right: 1em; + padding-bottom: 1em; + padding-left: 1.5em; + border-width: 0; + border-top-width: 4px; + border-top-style: solid; + border-bottom-width: 4px; + border-bottom-style: solid; + text-align: center; + font-weight: bold; + } + +.message pre { + font-weight: normal !important; + text-align: left !important; + font-size: 1em !important; + +} +/* Footer */ + +#footer { + background-color: #204C8D; + background-image: url(img/header-background.png); + margin-top: 1em; + clear:both; + } + +#footer p { + font-size: small; + margin: 5px; + } + +#footer .mainlinks { + border-bottom: none; + height: 23px; + } + +#footer .mainlinks li { + padding-top: 4px; + padding-bottom: 2px; +} + +#footer .mainlinks li.current { + margin-top: -3px; + padding-bottom: 3px; + padding-top: 6px; +} + + +#footer .sublinks { + border-top:2px solid #cad9ee; + border-bottom-color: #6FA4DF; + } + +#footer .credits { + color: #eee; + font-size: small; + padding: 1em; + } + +#footer .credits p.right { + float: right; + padding-left: 15em; + text-align: right; +} diff --git a/Scripts/Php/Webenv/config.php b/Scripts/Php/Webenv/config.php new file mode 100755 index 0000000..583ec83 --- /dev/null +++ b/Scripts/Php/Webenv/config.php @@ -0,0 +1,59 @@ + diff --git a/Scripts/Php/Webenv/contents/content.php b/Scripts/Php/Webenv/contents/content.php new file mode 100644 index 0000000..3032b7c --- /dev/null +++ b/Scripts/Php/Webenv/contents/content.php @@ -0,0 +1,43 @@ +
    + + + +
    + +
    + +Donaciones

    Esta es la pagina de las donaciones

    '; +$page[2] = '

    Documentacion

    Esta es la pagina de la documentacion.

    '; +$page[3] = '

    Wiki

    Esta es la pagina de la wiki.

    '; +$page[4] = '

    Foros

    Esta es la pagina de los foros.

    '; + +// Initialize variables +if ( isset($_GET['p']) ) { + + // If $_GET['p'] is set the content shown is the pages one. + $id = htmlspecialchars($_GET['p']); + + echo $page[$id]; +} +else +{ + // If $_GET['p'] is not set the content shown is the entries's loop. + echo get_html_err(); +} + +// Validate id value + +?> + +
    +
    diff --git a/Scripts/Php/Webenv/contents/footer.php b/Scripts/Php/Webenv/contents/footer.php new file mode 100644 index 0000000..b902f6e --- /dev/null +++ b/Scripts/Php/Webenv/contents/footer.php @@ -0,0 +1,20 @@ + + + + + + diff --git a/Scripts/Php/Webenv/contents/header.php b/Scripts/Php/Webenv/contents/header.php new file mode 100644 index 0000000..1a1aa72 --- /dev/null +++ b/Scripts/Php/Webenv/contents/header.php @@ -0,0 +1,32 @@ + + + + + + <?php echo HTML_TITLE ?> + + + + + + diff --git a/Scripts/Php/Webenv/contents/images/h1-background.png b/Scripts/Php/Webenv/contents/images/h1-background.png new file mode 100755 index 0000000..966b7ed Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/h1-background.png differ diff --git a/Scripts/Php/Webenv/contents/images/h2-background.png b/Scripts/Php/Webenv/contents/images/h2-background.png new file mode 100755 index 0000000..7966dc0 Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/h2-background.png differ diff --git a/Scripts/Php/Webenv/contents/images/header-background.png b/Scripts/Php/Webenv/contents/images/header-background.png new file mode 100755 index 0000000..ff2a7b0 Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/header-background.png differ diff --git a/Scripts/Php/Webenv/contents/images/html-background.png b/Scripts/Php/Webenv/contents/images/html-background.png new file mode 100755 index 0000000..30f7d70 Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/html-background.png differ diff --git a/Scripts/Php/Webenv/contents/images/layeredTech_logo08.gif b/Scripts/Php/Webenv/contents/images/layeredTech_logo08.gif new file mode 100755 index 0000000..c31ec0b Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/layeredTech_logo08.gif differ diff --git a/Scripts/Php/Webenv/contents/images/logo.png b/Scripts/Php/Webenv/contents/images/logo.png new file mode 100644 index 0000000..4828ae2 Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/logo.png differ diff --git a/Scripts/Php/Webenv/contents/images/release-promo.png b/Scripts/Php/Webenv/contents/images/release-promo.png new file mode 100644 index 0000000..a4221c7 Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/release-promo.png differ diff --git a/Scripts/Php/Webenv/contents/images/rss.png b/Scripts/Php/Webenv/contents/images/rss.png new file mode 100644 index 0000000..79767ef Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/rss.png differ diff --git a/Scripts/Php/Webenv/contents/images/ul.png b/Scripts/Php/Webenv/contents/images/ul.png new file mode 100755 index 0000000..fd89ccd Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/ul.png differ diff --git a/Scripts/Php/Webenv/contents/images/ul2.png b/Scripts/Php/Webenv/contents/images/ul2.png new file mode 100644 index 0000000..467b107 Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/ul2.png differ diff --git a/Scripts/Php/Webenv/contents/images/xpressbannew_240.gif b/Scripts/Php/Webenv/contents/images/xpressbannew_240.gif new file mode 100644 index 0000000..dfdf197 Binary files /dev/null and b/Scripts/Php/Webenv/contents/images/xpressbannew_240.gif differ diff --git a/Scripts/Php/Webenv/contents/sidebar.php b/Scripts/Php/Webenv/contents/sidebar.php new file mode 100644 index 0000000..11e3b77 --- /dev/null +++ b/Scripts/Php/Webenv/contents/sidebar.php @@ -0,0 +1,35 @@ +
    + +
    promo
    + +
    + +

    + +
    + +
    +

    + +
    + +
    +

    + +
    + +
    + +
    + +
    + +
    diff --git a/Scripts/Php/Webenv/contents/single.php b/Scripts/Php/Webenv/contents/single.php new file mode 100644 index 0000000..bebb7e4 --- /dev/null +++ b/Scripts/Php/Webenv/contents/single.php @@ -0,0 +1,43 @@ +
    + +The page $id isn't readable!

    "; + } + + } + else { + echo "

    The page $id doesn't exist!

    "; + } + +} +else { + + $id = 0; + include("pages/p_index.php"); + +} + +// Validate id value + +?> + +
    diff --git a/Scripts/Php/Webenv/contents/style.css b/Scripts/Php/Webenv/contents/style.css new file mode 100644 index 0000000..58888cd --- /dev/null +++ b/Scripts/Php/Webenv/contents/style.css @@ -0,0 +1,554 @@ +/*** + * Style used in some server responses. + * + * -- CentOS Artwork SIG. + * http://projects.centos.org/trac/artwork/wiki/WebServerCustomization + */ + +html { + background-color: #FFF; + background-image: url(images/html-background.png); + font-family: "DejaVu Sans", "Liberation Sans", sans-serif; + font-size: 0.85em; + line-height: 1.25em; + margin: 0 4% 0 4%; /* <- with 4% of left and right margin */ + } + +body { + background: #FFF; + border-width: 10px; + border-style: solid; + border-color: #FFF; + padding:0; + margin: 0; + } + +/* RSS */ + +#header .rss { + float:right; + padding: 0; + margin: 0; + margin-right: 1em; + border: none; +} + +/* Links */ + +a:link { text-decoration: none; color: #204C8D } +a:hover { text-decoration: underline; color: green; } +a:active { text-decoration: underline; color: green; } +a:visited { text-decoration: none; color: #204C8D; } +a:visited:hover { text-decoration: underline; color: green; } + +#footer .credits a:link { border-bottom: 1px dotted #eee; text-decoration: none; color: #eee } +#footer .credits a:hover { border-bottom: 1px dotted #eee; text-decoration: underline; color: #fff; } +#footer .credits a:active { border-bottom: 1px dotted #eee; text-decoration: underline; color: #eee; } +#footer .credits a:visited { border-bottom: 1px dotted #eee; text-decoration: none; color: #eee; } +#footer .credits a:visited:hover { border-bottom: 1px dotted #eee; text-decoration: underline; color: #fff; } + +/* Alignment */ + +.floatr { float: right; } +.floatl { float: left; } + +/* Lists */ + +#content ul, +#content ol { + padding-left: 1.9em; + margin-left: 3em; + margin-bottom: 1em; + } + +#content ul { + list-style: url("images/ul.png") circle; + } + +#content ol { + list-style-image: none !important; + } + +#content ul li { + padding-left: 0em; + margin-bottom: 0.3em; + } + +#content ol li { + padding-left: 0em; + margin-bottom: 0.3em; + } + +#content ul ul, +#content ul ol, +#content ol ul, +#content ol ol { + margin-left: 0.5em; + margin-top: 0.3em; + } + +#content ul li p, +#content ol li p { + margin-bottom: 0.3em; + line-height: 1.5em; + margin-left: 0 !important; + } + +/* Tables */ + +#content table { + width: 100%; + font-size: inherit; + } + +#content th { + padding-left: 5px; + padding-right: 5px; + } + +#content th { + background-image: url(images/h2-background.png); + } + +/* Presentation */ + +#header { + background-color: #204C8D; + background-image: url(images/header-background.png); + color: #fff; + } + +#header div.people_info { + float: right; + padding: 0.3em 10% 1.2em 1.2em; + padding-right: 10%; + text-align: center; + } + +#header .adminlinks { + float:right; + margin: 0.5em; + text-align: right; + font-size: 0.9em; + color: #eee; +} + +#header .adminlinks a { + margin-left: 0.5em; + margin-right: 0.5em; +} + +#logo { + color: #fff; + padding: 10px; + width: 500px; + } + +#logo img { + border: none; +} + +#logo .logo_text{ + font-size: 1.7em; + color: #fff; + margin-top: -50px; + float:left; + margin-left: 260px; + text-align:left; +} + +/* Ads */ + +.googlecontent { + clear: right; + margin: 0; +} + +/* Page lines */ + +.pageline_dark { + border: 1px solid #31629b; + clear: both; + margin:0; + padding:0; +} + +.pageline { + border-bottom:2px solid #cad9ee; + clear: both; + margin:0; + padding:0; +} + +.pageline_soft { + border: 1px solid #fff; + clear: both; + margin:0; + padding:0; +} + +/* Mainlinks */ + +.mainlinks { + display: block; + padding: 0; + padding-left: 20px; + margin: 0; + font-size: 0.8em; + background-color: #2b4f80; + height: 23px; + border-bottom: 2px solid #6fa4df; + } + +.mainlinks li { + float: left; + display: inline; + white-space: nowrap; + font-weight: bold; + padding:0; + padding-top:3px; + padding-bottom:3px; + } + +.mainlinks li a { + /* To cover the box area as linkable */ + padding: 10px; + padding-top: 4px; + padding-bottom: 4px; + border-right: 1px solid #25456f; + border-left: 1px solid #31629b; + } + +.mainlinks a, +.mainlinks a:visited { + color: #BDD3FB; + text-decoration: none; + } + +.mainlinks li.current a { + color: #25456f; + border-right: 1px solid #fff; + border-left: 1px solid #fff; + text-decoration: none; + } + +.mainlinks li:hover { + background-color: #436595; + padding-bottom: 3px; + } + +.mainlinks li:hover a { + color: #BDD3FB; + text-decoration: none; + } + +.mainlinks li:hover a:active { color:#BDD3FB; background-color:#436595; text-decoration:none;} +.mainlinks li a:active { color:#BDD3FB; background-color:#436595; text-decoration:none;} + +.mainlinks li.current, +.mainlinks li.current:hover, +.mainlinks li.current:hover a, +.mainlinks li.current:active a { + color: #25456f; + background-color: #fff; + padding-bottom: 5px; + } + +/* Entries pager */ + +#content .entrypager { + border-top: 1px solid #f8f8f8; + clear: both; +} + +#content .entrypager span { + display: inline; + font-size: 0.9em; + padding: 1em; +} + +/* Content */ + +#content .columnl { + display: block; + background-color: #fff; + margin: 0; + margin-right: 300px; + padding: 20px; + } + +#content .columnr { + display: block; + width: 300px; + float:right; + background: #f6f9ff; + border: 1px solid #a0bbe1; + margin-bottom: 1em; + } + +#content .columnr div { + margin: 0; + padding: 1em; + font-size: 0.9em; + } + +#content .columnr a { + font-weight: bold; +} + +#content .columnr div.row, +#content .columnr div.row_search, +#content .columnr div.row_download, +#content .columnr div.row_promo, +#content .columnr div.row_release, +#content .columnr div.row_user, +#content .columnr div.row_sponsor, +#content .columnr div.row_subscribe { + border-top: 1px solid #fff; + border-bottom: 1px solid #cad9ee; +} + +#content .columnr div ul { + margin: 0; + list-style: url("images/ul2.png") circle; +} + +#content .columnr div.row_promo img { + padding: 5px; + background: #fff; + border: 1px solid #a0bbe1; +} + +#content .columnr div.center { text-align: center; } + +#content .columnr div.last { + border-top: 1px solid #fff; + border-bottom: none; +} + +#content .columnr p.first { + border-top: none; +} + +#content h1 { + color: #333; + line-height: 1em; + margin: 0px; + margin-bottom: 1em; + padding: 0px; +} + +#content h2, +#content h3, +#content h4, +#content h5, +#content h6 { + color: #333; + line-height: 0.7em; + margin: 0px; + margin-bottom: 1em; + padding: 0px; + } + +#content tt { + font-family: "DejaVu Sans Mono", "Liberation Sans Mono", monospace; +} + +#content { + clear:both; + padding: 1em; + background: #fff; +} + +#content p { + color: #333; + line-height: 1.5em; + margin: 0; + padding: 0; + margin-bottom: 1em; + margin-top: 1em; +} + +#content pre { + font-size: 1.4em; + border-width: 1px; + border-style: solid; + border-color: #E5E5E5; + border-left-width: 4px; + white-space: pre; + background: #FFFAE9; + overflow: auto; + padding: 1em; +} + +#content hr { + margin-top: 1em; + margin-bottom: 1em; + padding: 0; + border: 1px solid #f8f8f8; + } + +.promoblock { + display: block; + float:left; + padding: 0; + padding-left: 1em; + padding-right: 0.5em; + margin-top: 0.5em; + margin-bottom: 0.5em; + border-left: 2px dotted #cad9ee; + height: 150px; + font-size: 0.8em; + width: 20%; +} + +.promoblock p { + padding: 0em; + line-height: 1.5em; + margin: 0em; + margin-bottom: 1em; +} + +.promoblock.last { width: 30%; } + +.promoblock.first { border-left: none;} + +#content div.post p.info { + font-size: 0.8em; + margin-top: -1em !important; +} + +#content div.post.first p.info { + margin-top: -2em !important; +} + +#content .post { + margin-top: 1em; + padding-top: 1em; +} + +#content .post.first { + border-bottom: 1px solid #f8f8f8; +} + + +#content .post.first h2 { + font-size: 2em; +} + +/* Content - Forms */ + +form { + margin: 0; + padding: 0; + display: inline; +} + +#header input[type="submit"], +#header input[type="text"] { + border-width: 2px; + border-style: solid; + border-color: #204C8D; + background-color: #3B71B8; + color: #FFFFFF; + display: inline; + text-decoration: none; + padding: 1px; + padding-left: 4px; + padding-right: 4px; + } + +#header input[type="submit"] { + font-weight: bold; + cursor: pointer; + font-size: 0.8em; +} + +#header input[type="text"] { + font-size: 0.85em; + margin-right: 2px; + display: inline; + padding: 2px; + padding-left: 4px; + border: 2px solid #204C8D; + background-color: #EDF4FF; + color: #204C8D; + width: 130px; +} +#header select { + font-size: 0.8em; + border-width: 2px; + border-style: solid; + border-color: #204C8D; + background-color: #3B71B8; + color: #FFFFFF; + cursor: pointer; + display: inline; + font-weight: bold; + text-decoration: none; + padding: 1px; + } + +.input { + /* does strange effect to button (text size becomes bigger when clicking) + font-size: 1em; + font-family: Arial, Lucida Grande, sans-serif; + */ + } + +textarea { + font-size: 1.4em; + font-family: "DejaVu Sans Mono", "Liberation Mono", monospace; + } + +.disabled { + color: gray; + } + +/* Footer */ + +#footer { + background-color: #204C8D; + background-image: url(images/header-background.png); + margin-top: 1em; + clear:both; + } + +#footer p { + font-size: small; + margin: 5px; + } + +#footer .mainlinks { + border-top: 2px solid #6fa4df; + border-bottom: none; + height: 23px; + } + +#footer .mainlinks li { + padding-bottom: 3px; +} + +#footer .mainlinks li.current { + margin-top: -3px; + padding-bottom: 3px; + padding-top: 6px; +} + + +#footer .sublinks { + border-top:2px solid #cad9ee; + border-bottom: none; + } + +#footer .credits { + color: #eee; + font-size: small; + padding: 1em; + } + +#footer .credits p.right { + float: right; + padding-left: 15em; + text-align: right; +} diff --git a/Scripts/Php/Webenv/includes/functions/html.php b/Scripts/Php/Webenv/includes/functions/html.php new file mode 100644 index 0000000..fe7cc4a --- /dev/null +++ b/Scripts/Php/Webenv/includes/functions/html.php @@ -0,0 +1,132 @@ +' . "\n"; + + if (!isset($_GET['p'])) + { + + $html .= '
  • ' . strtoupper(translate('home')) . '
  • ' . "\n"; + + } + else + { + $html .= '
  • ' . strtoupper(translate('home')) . '
  • ' . "\n"; + } + + foreach ($mainlinks as $key => $value) + { + if (isset($_GET['p']) && $_GET['p'] == $key) + { + $html .= '
  • ' . strtoupper($value). "
  • " . "\n"; + } + else + { + $html .= '
  • ' . strtoupper($value). "
  • " . "\n"; + } + } + +$html .= '' . "\n"; +return $html; + +} + + // Display promotions +function get_html_promo() +{ + $promotion = array(); + $promotion['CentOS-5 Releases'] = 'Information about CentOS-5 releases will be displayed here. Read more ...'; + $promotion['CentOS-4 Releases'] = 'Information about CentOS-5 releases will be displayed here. Read more ...'; + $promotion['CentOS-3 Releases'] = 'Information about CentOS-5 releases will be displayed here. Read more ...'; + $promotion['CentOS-2 Releases'] = 'Information about CentOS-5 releases will be displayed here. Read more ...'; + + $counter = 0; + $last_promotion = count($promotion) -1; + + echo '
    ' . "\n"; + + foreach ( $promotion as $key => $value ) + { + + // Set first promoblock + switch ($counter) + { + case 0: + $html = '
    '; + break; + + case $last_promotion: + $html .= '
    '; + break; + + default: + $html .= '
    '; + } + + $html .= '

    ' . $key . '

    ' . "\n"; + $html .= '

    ' . $value . '

    ' . "\n"; + $html .= '
    '; + + $counter++; + } + +return $html; + +} + +function get_html_searchform() +{ + $html = '
    '; + $html .= '
    '; + $html .= ''; + $html .= ''; + $html .= '
    '; + $html .= '
    '; + + return $html; +} + +// Build 404 page not found error +function get_html_err($err_id = '404', $err_msg = 'Page not found', $err_descrip = '') +{ + $html = '

    ' . $err_id . ': ' . ucfirst($err_msg) . '

    ' . "\n"; + $html .= '

    ' . $err_descrip. '

    '; + return $html; +} + +?> diff --git a/Scripts/Php/Webenv/includes/translations/en.php b/Scripts/Php/Webenv/includes/translations/en.php new file mode 100644 index 0000000..7616ba6 --- /dev/null +++ b/Scripts/Php/Webenv/includes/translations/en.php @@ -0,0 +1,42 @@ + + */ + + function translate($word) + { + + $translation = array('' => '', + // Admonition translations + // LDAP translations + 'uid' => 'User ID', + 'cn' => 'Full Name', + 'preferredlanguage' => 'Language', + 'employeetype'=>'privileges', + 'displayname'=>'nickname', + 'userpassword'=>'password', + // Others + 'go back' => 'go back', + 'default_f' => 'default', + 'default_m' => 'default', + 'en' => 'English', + 'credits_on_footer_1' => 'The CentOS Project - '.date('Y').' | "Linux" is a registered trademark of Linus Torvalds. All other trademarks are property of their respective owners.', + ''=>''); + + // if $word hasn't a translation here, return it. + if ( array_key_exists($word, $translation)) + { + $translation[$word] = $translation[$word]; + return $translation[$word]; + } + else + { + return $word; + } + } + +?> diff --git a/Scripts/Php/Webenv/includes/translations/es.php b/Scripts/Php/Webenv/includes/translations/es.php new file mode 100644 index 0000000..0057d1c --- /dev/null +++ b/Scripts/Php/Webenv/includes/translations/es.php @@ -0,0 +1,162 @@ + + */ + + function translate($word) + { + $translation = array(); + $translation = array('change' => 'cambiar', + // Errores Messages + '001' => 'nombre de usuario o contraseña incorrecta!', + '002' => 'Se encontraron valores duplicados en el directorio LDAP para el campo uid', + 'a valid uid is required' => 'se requiere un identificador único de usuario', + 'the field' => 'el campo', + 'invalid action' => 'acción no soportada', + 'user added successfully' => 'el usuario fue adicionado satisfactoriamente', + 'is required' => 'es obligatorio', + 'requires a valid value' => 'tiene un valor incorrecto', + 'incorrect value in the field' => 'valor incorrecto en el campo', + 'user identifier already exists' => 'el identificador único de usuario ya existe', + 'successful update' => 'actualización satisfactoria', + 'update failed' => 'actualización fallida', + 'nothing to do' => 'nada que hacer', + 'data was removed successfully' => 'los datos fueron eliminados satisfactoriamente', + 'data was deleted successfully' => 'los datos fueron eliminados satisfactoriamente', + 'data was updated successfully' => 'los datos fueron actualizados satisfactoriamente', + 'data was not removed' => 'los datos no fueron eliminados', + "the category dosn't exist" => "la categoría no existe", + 'data was not updated' => 'los datos no fueron actualizados', + 'field name can not be empty' => 'El campo nombre no puede estar vacío', + 'id value is incorrect' => 'El valor del campo Id es incorrecto', + 'record deleted successfully' => 'registro eliminado satisfactoriamente', + 'records deleted successfully' => 'registros eliminados satisfactoriamente', + 'category was added successfully' => 'la categoría fue adicionada satisfactoriamente', + 'category was not added' => 'la categoría no fue adicionada', + 'invalid cn' => 'valor incorrecto en el campo nombre común' , + 'page not found' => 'página no encontrada' , + // LDAP attributes + 'cn' => 'nombre común', + 'mail' => 'correo', + 'uid' => 'identificador único', + 'preferredlanguage' => 'Idioma preferido', + 'displayname' => 'Apodo', + 'userpassword' => 'Contraseña', + 'employeetype' => 'tipo de empleo', + // Database error messages + 'connected' => 'conectado', + 'Field name can not be empty' => 'El campo Nombre no puede estar vacío', + 'name' => 'nombre', + 'description' => 'descripción', + 'disconnected' => 'desconectado', + // Non error messages below + 'home' => 'inicio', + 'edit' => 'Editar', + 'delete' => 'eliminar', + 'es' => 'Español', + 'download' => 'descargas', + 'links' => 'enlaces', + 'comments' => 'comentarios', + 'comment' => 'comentario', + 'link' => 'enlace', + 'parent category' => 'categoría padre', + 'group' => 'grupo', + 'default_f' => 'predeterminada', + 'default_m' => 'predeterminado', + 'none' => 'ninguno', + 'administrator' => 'administrador', + 'writer' => 'escritor', + 'find' => 'Buscar', + 'archive' => 'archivo', + 'hello' => 'hola', + 'actions' => 'acciones', + 'action' => 'acción', + 'accept' => 'aceptar', + 'remove' => 'eliminar', + 'user' => 'usuario', + 'logout' => 'salir', + 'filter' => 'filtrar', + 'contactus' => 'contáctenos', + 'news' => 'noticias', + 'administration' => 'administración', + 'admin' => 'administrar', + 'support' => 'soporte', + 'write' => 'escribir', + 'ex' => 'ej', + 'information' => 'información', + 'events' => 'eventos', + 'mailinglists' => 'listas de correo', + 'bugs' => 'bugs', + 'help' => 'ayuda', + 'documentation' => 'documentación', + 'faqs' => 'faqs', + 'forums' => 'foros', + 'wiki' => 'wiki', + 'donate' => 'donaciones', + 'language' => 'idioma', + 'languages' => 'idiomas', + 'permissions' => 'permisos', + 'go' => 'ir', + 'login' => 'entrar', + 'bugs' => 'errores', + 'hi' => 'hola', + 'powered by' => 'soportado por', + 'register' => 'registrar cuenta nueva', + 'newaccount' => 'cuenta nueva', + 'lostpwd' => 'perdió su contraseña ?', + 'previous entries' => 'Entradas anteriores', + 'next entries' => 'Entradas siguientes', + 'update' => 'Actualizar', + 'first' => 'primero', + 'last' => 'ultimo', + 'password' => 'contraseña', + 'categories' => 'categorías', + 'category' => 'categoría', + 'category tree' => 'Árbol de categorías', + 'hierarchy' => 'jerarquía', + 'close' => 'cerrar', + 'session' => 'sesión', + 'view' => 'ver', + 'go back to' => 'regresar al', + 'go back' => 'regresar', + 'site' => 'sitio', + 'add' => 'adicionar', + 'years' => 'años', + 'permissions' => 'permisos', + 'note' => 'nota', + 'news' => 'noticias', + 'user' => 'usuario', + 'welcome' => 'bienvenido', + 'search results' => 'Resultados de la búsqueda', + 'results' => 'resultados', + 'looking in' => 'buscando en', + 'filtering by' => 'filtrando por', + 'admin_info_1' => 'esta aplicación te permitirá administrar el portal.', + 'entry' => 'entrada', + 'page' => 'página', + 'users' => 'usuarios', + 'entries' => 'entradas', + 'portal administration' => 'Administración del portal', + 'pages' => 'páginas', + 'sponsors' => 'patrocinadores', + 'search' => 'buscar', + 'credits_on_footer_1' => 'The CentOS Project - '.date('Y').' | "Linux" es una marca registrada de Linus Torvalds. Todas las otras marcas comerciales son propiedad de sus respectivos dueños.', + 'username' => 'usuario' ); + + // if $word hasn't a translation here, return it. + if ( array_key_exists($word, $translation)) + { + $translation[$word] = $translation[$word]; + return $translation[$word]; + } + else + { + return $word; + } + +} +?> diff --git a/Scripts/Php/Webenv/index.php b/Scripts/Php/Webenv/index.php new file mode 100755 index 0000000..b585d0b --- /dev/null +++ b/Scripts/Php/Webenv/index.php @@ -0,0 +1,25 @@ + diff --git a/Scripts/Python/Webenv/Apps/Home/__init__.py b/Scripts/Python/Webenv/Apps/Home/__init__.py new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/Scripts/Python/Webenv/Apps/Home/__init__.py diff --git a/Scripts/Python/Webenv/Apps/Home/page.py b/Scripts/Python/Webenv/Apps/Home/page.py new file mode 100755 index 0000000..97e12eb --- /dev/null +++ b/Scripts/Python/Webenv/Apps/Home/page.py @@ -0,0 +1,91 @@ +"""Support module for page layout inside `Home' web application. + +""" +from Apps import page + +app = page.Layout() + + +def page_navibar(): + """Returns application main pages. + + The application main pages are organized as tabs in the + application navigation bar. There is one tab for each main page + inside the application. + + """ + names = ['Page1', 'Page2', 'Page3'] + attrs = [] + + for i in names: + attrs.append({'href': '/webenv/?p=' + i.lower()}) + + if 'p' in page.qs.keys(): + focus = page.qs['p'][0].lower() + else: + focus = '' + + return app.page_navibar(names, attrs, focus) + + +def page_content(): + """Returns page content. + + The page content is determined from the query string, specifically + from the value of `p' variable. + + """ + if 'p' in page.qs.keys(): + p = page.qs['p'][0].lower() + else: + p = '' + + if p == 'page1': + output = app.tag_p('', [12, 1], 'Page Empty.') + elif p == 'page2': + output = app.tag_p('', [12, 1], 'Page Empty.') + elif p == 'page3': + output = app.tag_p({}, [12, 1], 'Page Empty' ) + elif p == 'entry': + output = app.content_details() + else: + output = app.content_list() + + return output + + +def main(): + """Returns final output.""" + + # Define page name. This value is used as reference to determine + # which application to load and what tab in the navigation bar to + # focus on. + app.name = 'Home' + + # Define page title. This value is dislayed on the browser's title + # bar. Notice that we concatenated the page class default value + # here. + app.title += ' :: Home' + + # Define page header. This is the information displayed + # between the page top and page content. + app.header = app.logo() + app.header += app.google_ad_example() + app.header += app.navibar() + app.header += app.releases() + app.header += app.page_links() + app.header += page_navibar() + + # Define page body. This is the information displayed between the + # page header and page footer. + app.body = page_content() + + # Define page footer. This is the information displayed between + # the page bottom and the page content, the last information + # displayed in the page. + app.footer = app.credits() + + # Define page final layout. + html = app.page() + + return html diff --git a/Scripts/Python/Webenv/Apps/Sponsors/__init__.py b/Scripts/Python/Webenv/Apps/Sponsors/__init__.py new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/Scripts/Python/Webenv/Apps/Sponsors/__init__.py diff --git a/Scripts/Python/Webenv/Apps/Sponsors/page.py b/Scripts/Python/Webenv/Apps/Sponsors/page.py new file mode 100755 index 0000000..1791750 --- /dev/null +++ b/Scripts/Python/Webenv/Apps/Sponsors/page.py @@ -0,0 +1,91 @@ +"""Support module for page layout inside `Sponsors' web application. + +""" +from Apps import page + +app = page.Layout() + + +def page_navibar(): + """Returns application's main pages. + + The application's main pages are organized as tabs in the + application navigation bar. There is one tab for each main page + inside the application. + + """ + names = ['Hardware', 'Hosting', 'Others'] + attrs = [] + + for i in names: + if 'app' in page.qs.keys(): + attrs.append({'href': '/webenv/?app=' + page.qs['app'][0].lower() + '&p=' + i.lower()}) + else: + attrs.append({'href': '/webenv/?p=' + i.lower()}) + + if 'p' in page.qs.keys(): + focus = page.qs['p'][0].lower() + else: + focus = names[0].lower() + + return app.page_navibar(names, attrs, focus) + + +def page_content(): + """Returns page content. + + The page content to show is determined from the query string, + specifically from the value of `p' variable. + + """ + if 'p' in page.qs.keys(): + p = page.qs['p'][0].lower() + else: + p = 'hardware' + + if p == 'hardware': + output = app.tag_h1({'class': 'title'}, [12, 1], 'Hardware Sponsors' ) + elif p == 'hosting': + output = app.tag_h1({'class': 'title'}, [12, 1], 'Hosting Sponsors' ) + elif p == 'others': + output = app.tag_h1({'class': 'title'}, [12, 1], 'Other Sponsors' ) + else: + output = app.tag_p('', [12, 1], 'Page empty.') + + return output + + +def main(): + """Returns final output.""" + + # Define page name. This value is used as reference to determine + # which application to load and what tab in the navigation bar to + # focus on. + app.name = 'Sponsors' + + # Define page title. This value is dislayed on the browser's title + # bar. Notice that we concatenated the page class default value + # here. + app.title += ' :: Sponsors' + + # Define page header. This is the information displayed + # between the page top and the page content. + app.header = app.logo() + app.header += app.google_ad_example() + app.header += app.navibar() + app.header += app.page_links() + app.header += page_navibar() + + # Define page body. This is the information displayed between the + # page header and page footer. + app.body = page_content() + + # Define page footer. This is the information displayed between + # the page bottom and the page content, the last information + # displayed in the page. + app.footer = app.credits() + + # Define page final layout. + html = app.page() + + return html diff --git a/Scripts/Python/Webenv/Apps/Unknown/__init__.py b/Scripts/Python/Webenv/Apps/Unknown/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Scripts/Python/Webenv/Apps/Unknown/__init__.py diff --git a/Scripts/Python/Webenv/Apps/Unknown/page.py b/Scripts/Python/Webenv/Apps/Unknown/page.py new file mode 100755 index 0000000..f7c564e --- /dev/null +++ b/Scripts/Python/Webenv/Apps/Unknown/page.py @@ -0,0 +1,54 @@ +"""The `Unknown' web application. + +The Unknown web application is automatically triggered when the page +requested is not defined as valid in `webenv.cgi' script. The +Unknown web application is basically an admonition message describing +the `page not found' issue and where to find the correct links to +start all over. + +""" +from Apps import page + +app = page.Layout() + + +def page_content(): + """Returns page content.""" + output = app.tag_p('', [16,1], 'The page you tried to open was not found in this server. Try one of the links above to start over.') + output = app.admonition('Warning', 'Page not found.', output) + output = app.tag_div({'id':'content-unknown'}, [8,1], output, 1) + return output + + +def main(): + """Returns final output.""" + + # Define page name. This value is used as reference to determine + # which application to load and what tab in the navigation bar to + # focus on. + app.name = 'Unknown' + + # Define page title. This value is dislayed on the browser's title + # bar. Notice that we concatenated the page class default value + # here. + app.title += ' :: Page not found' + + # Define page header. This is the information displayed + # between the page top and the page content. + app.header = app.logo() + app.header += app.google_ad_example() + app.header += app.navibar() + + # Define page body. This is the information displayed between the + # page header and page footer. + app.body = page_content() + + # Define page footer. This is the information displayed between + # the page bottom and the page content, the last information + # displayed in the page. + app.footer = app.credits() + + # Define page final layout. + html = app.page() + + return html diff --git a/Scripts/Python/Webenv/Apps/__init__.py b/Scripts/Python/Webenv/Apps/__init__.py new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/Scripts/Python/Webenv/Apps/__init__.py diff --git a/Scripts/Python/Webenv/Apps/page.py b/Scripts/Python/Webenv/Apps/page.py new file mode 100755 index 0000000..126be63 --- /dev/null +++ b/Scripts/Python/Webenv/Apps/page.py @@ -0,0 +1,970 @@ +# Copyright (C) 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ------------------------------------------------------------------ +# $Id$ +# ------------------------------------------------------------------ +"""Support page construction. + +The page construction is an XHTML document consisting of several +independent components that, when put together, provide organization +to content. Each of these components is set as a method of Layout +class that can be instantiated later from application specific modules. + +When you create a new application package, you need to create a page +module for it and instantiate the Layout class provided here inside +it. Later, the following functions must be created: page_content(), +page_navibar() and main(). These functions are used to define the +content and navigation bar of your application. Both application +content and application navigation are logically organized using +variables passed through the URL. + +Application +=========== + +URL variable: app + +This variable contains the application id. It is a unique numerical +value that starts at 0 and increments one for each new application +that might be added. The application identified by number 0 is the one +used as default when no other application is provided. The +application identified by number 0 is added to database the first time +it is created as part of the initial configuration process. + +Application is the highest level of organization inside +`webenv.cgi' script. Inside applications, there is content in form +of pages and entries. Content can be grouped by categories. + +Pages +===== + +URL variable: page + +This variable contains the page id. It is a unique numerical value +that starts at 0 and increments in one for each new page added to the +application. In contrast to applications, the page identified by +number 0 is not used as default page when no other page is provided. +This configuration is specific to each application and can be +customized inside each application individually, using string values +instead of numerical values when passing values to page variable. + +Generally, when a page variable isn't passed through the URL, the +application module uses the `content_list()' method from Layout class +to display a list of all available content entries while links to +content pages are displayed in the application navigation bar so users +can access them. The unique numerical value of content pages is +specific to each application, so there is one page 0 for each +application available. No page is added to database the first time the +database is created as part of the initial configuration process. + +Pages contain similar information to that described by contents with +few exceptions. Pages, in contrast to entries, can differentiate the +page title from the page name. The page title goes in the page content +itself and describes what the page is about with a phrase. On the +other hand, the page name is generaly one word describing the page +content and is used as link on the application navigation bar. When +no page name is explicitly provided, the first word of page title is +used instead. + +Pages are always accessible inside the same application while contents +aren't. Pages are permanently visible and linkend from each +application specific navigation bar. This kind of pages can be +managed by editors or administrators and can be marked as `draft' to +put it on a special state where it is possible for administrator, +editors and authors to work on it, but impossible for others to read +it until the page be marked as `published' by either the page author +or any members of editor's or administrator's groups. + +Pages can be converted to entires and the oposite. When convertion +occurs, unused information looses its meaning and is kept for +informative purpose, specially in situations when it might be needed +to realize a convertion back into the former state. Notice that in +order to realize such a back and forth convertion it is required that +both pages and entires share the same definition structure. In fact, +that they be the same thing, but able to differentiate themselves +either as page or entry (e.g., through a `type' field.). + +Pages content is under version control. When a page (or entry) is +changed, a verification is performed to determine whether the +information entered in edition matches the last record in the page +history table. When both the information coming from edition and the +last record in the page history table are the same (e.g., no change +happened) the edition action is cancelled and a message is printed out +to notify the action. Otherwise, when the information entered in +edition differs from the last record in the page history table, the +information comming from edition passes to be the last record in the +page history table. In case, a page be reverted to a revision +different to that one being currently the active page, the reverted +revision becomes the active page (e.g., by changing a `status' field +from `false' to `true' in the history table). + +Categories +========== + +Categories exists to organize contents. When an entry is created it is +automatically linked to a category. Categories are managed by +administrators and editors only. Categories can be nested one another +and provide another way of finding information inside the web +environment. Categories are specific to each web application, just as +contents and pages are. The `Unknown' category is created when the +categories table is created for first time, as part of the initial +configuration process so if no explicit category assignation is set by +the user, a default value (the `Unknown' category in this case) is +used to satisfy the connection between contents and categories. + +Referential integrity +===================== + +Referential integrity is not handle in the logic layer provided by +this module, but set inside the database system used to store the +information handled by this module. The most we do about it here, is +to display a confirmation message before committing such actions, so +you can be aware of them. + +""" + +import cgi +import cgitb; cgitb.enable() +from Apps import xhtml + +qs = cgi.parse() + + +def qs_args( names={}): + """Returns query string arguments. + + The query string arguments are used to build links dynamically + and, this way, to create a browsable and logically organized web + environment. Such a construction generally needs to retrive some + of the values previously passed to the query string and add new + ones to it. + + names: A dictionary containing the variable name and value pair + used to build a new query string. + + When a variable is provied without a value, then its value is + retrived from the current query string. If a value isn't found + there neither, then the variable is removed from the new query + string. + + When a variable is provided with its value, then its value is used + to build the new query string. + + """ + output = '' + + names_keys = names.keys() + names_keys.sort() + for key in names_keys: + if names[key] == '': + if key in qs: + names[key] = qs[key][0] + else: + continue + if output == '': + output = '?' + else: + output += '&' + output += key + '=' + str(names[key]) + + return '/webenv/' + output + + +class Layout(xhtml.Strict): + """The Page Layout. + + The page layout is made by combining XHTML tags in specific ways. + These specific combinations make the page components which in turn + can be also combined. Some of these components can be reused and + others don't. The goal of this class is to define what such + components are and describe them well in order to understand how + to use them from application modules when building XHTML documents + dynamically. + + The page layout is initialized with a functional layout that can + be used as reference inside application modules, to create + variations of it. Generally, inside application packages, this + class is instantiated in a module named `page', variables are + reset and functions created in order to satisfy that application + needs. When you need to output one of the page components then you + use this class instantiated methods. When the method you need + doesn't exist in this class, then it is a good time for it to be + created, here ;). + + Notice that most methods defined in this class make direct use of + methods defined by Strict class inside the `xhtml' module. The + Strict class inside xhtml module is inherited inside this class so + all the methods there are also available here. Methods which + doesn't make a direct use of Strict methods are dependencies of + those which do make direct use of Strict methods. + + """ + + + def __init__(self): + """Initialize page data.""" + self.name = 'Home' + self.title = 'The CentOS Project' + self.description = 'Community Enterprise Operating System' + self.keywords = 'centos, project, community, enterprise, operating system' + self.copyright = '2009-2011 The CentOS Project. All rights reserved.' + self.language = 'en' + + # Define page header. This is the information displayed + # between the page top and the page content. + self.header = self.logo() + self.header += self.google_ad() + self.header += self.navibar() + self.header += self.releases() + self.header += self.page_links() + self.header += self.page_navibar() + + # Define page body. This is the information displayed between + # the page header and page footer. + self.body = 'None' + + # Define page footer. This is the information displayed + # between the page bottom and the page content, the last + # information displayed in the page. + self.footer = self.credits() + + + def logo(self): + """Returns The CentOS Logo. + + The page logo is displayed on the top-left corner of the page. + We use this area to show The CentOS Logo, the main visual + representation of The CentOS Project. In order to print the + page logo correctly, the image related must be 78 pixels of + height. + + """ + attrs = [] + attrs.append({'id': 'logo'}) + attrs.append({'title': 'Community Enterprise Operating System', 'href': '/webenv/'}) + attrs.append({'src': '/webenv-pub/Images/centos-logo.png', 'alt': 'CentOS'}) + + return self.tag_div(attrs[0], [8,1], self.tag_a(attrs[1], [12,1], self.tag_img(attrs[2], [0,0]), 0), 1) + + + def google_ad_example(self): + """Returns Google advertisement for offline testings.""" + title = 'Google Advertisement' + url = '/webenv-pub/Images/ads-sample-468x60.png' + image = self.tag_img({'src': url, 'alt': title}, [0,0]) + link = self.tag_a({'href': url, 'title': title}, [12,1], image) + output = self.tag_div({'class':'google-ad'}, [8,1], link, 1) + output += self.separator({'class':'page-line'}, [8,1]) + + return output + + + def google_ad(self): + """Returns Google advertisement for online using.""" + + properties = {} + properties['google_ad_client'] = 'pub-6973128787810819' + properties['google_ad_width'] = '468' + properties['google_ad_height'] = '60' + properties['google_ad_format'] = '468x60_as' + properties['google_ad_type'] = 'text_image' + properties['google_ad_channel'] = '' + properties['google_color_border'] = '204c8d' + properties['google_color_bg'] = '345c97' + properties['google_color_link'] = '0000FF' + properties['google_color_text'] = 'FFFFFF' + properties['google_color_url'] = '008000' + + attrs = {} + attrs['type'] = "text/javascript" + + output = '\n' + + properties = self.tag_script(attrs, [12,1], output, 1) + + attrs['src'] = "http://pagead2.googlesyndication.com/pagead/show_ads.js" + + source = self.tag_script(attrs, [12,1], ' ', 0) + + output = self.tag_div({'class':'google-ad'}, [8,1], properties + source, 1) + output += self.separator({'class':'page-line'}, [8,1]) + + return output + + + def navibar(self): + """Returns webenv navigation bar. + + The webenv navigation bar organizes links to main web + applications The CentOS Project makes use of. Links to these + web applications stay always visible, no matter what web + application the user be visiting (e.g., Wiki, Lists, Forums, + Projects, Bugs, Docs, Downloads and Sponsors.). Notice that + some of these web applications are out of `webenv.cgi' + scope and they need to code their own webenv navigation bars + in a way that coincide the one set by `webenv.cgi'. + + """ + names = ['Home', 'Wiki', 'Lists', 'Forums', 'Projects', 'Bugs', 'Docs', 'Downloads', 'Sponsors'] + attrs = [] + focus = self.name + + for i in range(len(names)): + if names[i].lower() == 'home': + attrs.append({'href': '/webenv/'}) + else: + attrs.append({'href': '/webenv/?app=' + names[i].lower()}) + + tabs = self.navibar_tabs(names, attrs, focus) + tabs += self.separator() + + return tabs + + + def navibar_tabs(self, names, attrs, focus=''): + """Returns navigation tabs. + + The navigation tabs are the smaller components a navigation + bar like "top-level navigation bar" and "application + navigation bar" are made of. + + names: List containing link names of tabs. + + attrs: List containing a dictionary for each tab link name + inside the `names' list. Dictionaries inside attrs + argument contain the link attributes (e.g., accesskey, + title, and href) used by link names so they can be + linkable once rendered. + + focus: Name of the link marked as current. + + """ + navibar_tabs = '' + + for i in range(len(names)): + output = self.tag_span('', [0,0], str(names[i])) + output = self.tag_a(attrs[i], [16,1], output) + if str(names[i]).lower() == focus.lower(): + output = self.tag_span({'class': 'current'}, [12,1], output, 1) + else: + output = self.tag_span('', [12,1], output, 1) + navibar_tabs += output + + return self.tag_div({'class': 'tabs'}, [8,1], navibar_tabs, 1) + + + def releases(self): + """Returns The CentOS Distribution last releases. + + This method introduces the `releases' method by providing + links to it. + + names: List containing release numbers in the form M.N, where M + means major release and N minor release. + + attrs: List containing a dictionary for each release number + provided in `names' argument. These dictionaries provide + the link attributes required by release numbers in order + for them to be transformed into valid links once the page + be rendered. + + """ + releases = '' + + names = [] + names.append('6.0') + + attrs = [] + attrs.append({'href': qs_args({'p':'releases', 'id': 6.0})}) + + + title = self.tag_a({'href': qs_args({'p':'releases'})}, [0,0], 'Last Releases') + ':' + title = self.tag_span({'class': 'title'}, [16,1], title) + + for i in range(len(names)): + link = self.tag_a(attrs[i], [20,1], names[i]) + if i == len(names) - 1: + span = self.tag_span({'class': 'last release'}, [16,1], link, 1) + else: + span = self.tag_span({'class': 'release'}, [16,1], link, 1) + releases += span + releases = self.tag_div({'class': 'left'}, [12,1], title + releases, 1) + + rsslink = self.tag_span('', [0,0], 'RSS') + rsslink = self.tag_a({'href': qs_args({'rss':'releases'}), 'title': 'RSS'}, [20,1], rsslink) + rsslink = self.tag_span({'class': 'rss'}, [16,1], rsslink, 1) + rsslink = self.tag_div({'class': 'right'}, [12, 1], rsslink, 1) + + return self.tag_div({'id': 'last-releases'}, [8,1], releases + rsslink, 1) + + + def user_links_logs(self): + """Return links related to user's logs. + + This function introduces the `logs' module. The `logs' module + registers all user's activity, from login to logout. This link + must be display/accessible only after a user has successfully + login. + + """ + last_visit = self.tag_a({'href': qs_args({'app':'', 'p':'logs'})}, [0,0], 'Logs') + return self.tag_div({'class': 'logs'}, [12, 1], last_visit, 1) + + + def user_links_session(self): + """Returns links related to user's session. + + This function introduces the `session' module. The `session' + module provides state to user interactions so their action can + be registered individually. + + """ + names = [] + attrs = [] + session = '' + + names.append('Lost your password?') + attrs.append({'href': qs_args({'app':'', 'p':'lostpwd'})}) + names.append('Register') + attrs.append({'href': qs_args({'app':'', 'p':'register'})}) + names.append('Login') + attrs.append({'href': qs_args({'app':'', 'p':'login'})}) + + for i in range(len(names)): + output = self.tag_a(attrs[i], [20,1], str(names[i]), 0) + if i == len(names) - 1: + output = self.tag_span({'class': 'last'}, [16,1], output, 1) + else: + output = self.tag_span('', [16,1], output, 1) + session += output + + return self.tag_div({'class': 'session'}, [12,1], session, 1) + + + def user_links_trails(self, names=['None'], attrs=[{'href': '/webenv/'}]): + """Returns page trails (a.k.a. breadcrumbs). + + The page breadcrumbs record the last pages the user visited + inside the current web application. Notice that page + breadcrumbs are user-specific information, so it isn't + possible to implement them until a way to manage user sessions + be implemeneted inside `webenv.cgi' script. Until then, + keep the tag construction commented and return an empty value. + + names: List with trail link names. + + attrs: Dictionary with trail link attributes. + + """ + links = '' + + for i in range(len(names)): + if i == len(names) - 1: + output = self.tag_span({'class':'last'}, [16,1], self.tag_a(attrs[i], [20, 1], names[i]), 1) + else: + output = self.tag_span('', [16,1], self.tag_a(attrs[i], [20, 1], names[i], 0), 1) + links += output + + return self.tag_div({'class': 'trail'}, [12,1], links, 1) + + + def user_links(self): + """Returns user related links. + + The user links are specific to each web application. They are + shown over the application navigation bar. + + """ + userlinks = self.user_links_logs() + userlinks += self.user_links_session() + userlinks += self.user_links_trails() + + return self.tag_div({'class': 'userlinks'}, [8,1], userlinks, 1) + + + def page_navibar(self, names=['Welcome'], attrs=[{'href':'/webenv/?p=welcome'}], focus='Welcome'): + """Returns navigation bar for application main pages. + + names: List containing link names. + + attrs: List containing one dictionary for each link name in + `names' argument. Dictionaries here contain the link + attributes needed to make linkable tabs once the page is + rendered. + + """ + navibar_app = self.navibar_tabs(names, attrs, focus) + navibar_app += self.separator({'class': 'page-line white'}, [8,1]) + + return navibar_app + + + def separator(self, attrs={'class': 'page-line'}, indent=[16,1]): + """Returns separator. + + The separator construction is mainly used to clear both sides + inside the page, specially when floating elements are around. + + attrs: Dictionary containing hr's div attributes. + + indent: List containing hr's div indentation values. + + """ + line = self.tag_hr({'style': 'display:none;'}, [0,0]) + line = self.tag_div(attrs, indent, line) + + return line + + + def license(self): + """Retruns license link.""" + license = 'Creative Commons Attribution-Share Alike 3.0 Unported License' + license = self.tag_a({'href': 'http://creativecommons.org/licenses/by-sa/3.0/'}, [0,0], license) + '.' + + return license + + + def metadata(self): + """Returns metadata.""" + metadata = self.tag_meta({'http-equiv': 'content-type', 'content': 'text/html; charset=UTF-8'}, [4,1]) + metadata += self.tag_meta({'http-equiv': 'content-style-type', 'content': 'text/css'}, [4,0]) + metadata += self.tag_meta({'http-equiv': 'content-language', 'content': str(self.language)}, [4,1]) + metadata += self.tag_meta({'name': 'keywords', 'content': str(self.keywords)}, [4,0]) + metadata += self.tag_meta({'name': 'description', 'content': str(self.description)}, [4,1]) + metadata += self.tag_meta({'name': 'copyright', 'content': 'Copyright © ' + str(self.copyright)}, [4,0]) + metadata += self.tag_title('', [4,1], self.title) + metadata += self.tag_link({'href': '/webenv-pub/stylesheet.css','rel': 'stylesheet', 'type': 'text/css'}, [4,0]) + metadata += self.tag_link({'href': '/webenv-pub/centos-fav.png', 'rel': 'shortcut icon', 'type': 'image/png'}, [4,1]) + + return self.tag_head('', [0,1], metadata) + + + + + def searchform(self, size=15): + """Returns search form. + + The search form redirects user from the current page onto the + search page, where the keywords previously introduced in the + input field are processed then. + + size: A number discribing how large the search box is. + + """ + input = self.tag_input({'type':'text', 'value':'', 'size':size}, [0,0]) + + action = self.tag_dt({}, [20,1], 'Search') + action += self.tag_dd({}, [20,1], input) + action = self.tag_dl({'class':'search'}, [16,1], action, 1) + + return self.tag_form({'action': qs_args({'app':'', 'p':'search'}), + 'method':'post', 'title':'Search'}, + [12,1], action, 1) + + + def content_resumen(self, attrs, id, title, user_id, commit_date, + update_date, category_id, comments, abstract): + """Returns content resumen. + + The content resumen is used to build the list of contents, + output by `content_list()' method. The content resumen intends + to be concise and informative so the user can grab a general + idea about the related content and what it is about. + + attrs: A dictionary discribing the rows style. This is useful + to alternate the row background colors. + + id: A unique numerical value referring the content + identification. This is the value used on administrative + tasks like updating and deleting. + + title: A few words phrase describing the content, up to 255 + characters. + + author_id: A string referring the user email address, as + specified by RFC2822. The user email address is used as id + inside The CentOS User LDAP server, where user specific + information (e.g., surname, lastname, office, phone, etc.) + are stored in. This is the field that bonds the user with + the content he/she produces. + + commit_date: A string referring the timestamp the content + arrived to database for time. + + update_date: A string representing the timestamp the content + was updated/revised for last time. + + category_id: A number refering the category id the content is + attached to. + + abstract: One paragraphs describing the content. This + information is used to build the page metadata + information. When this value is not provided no abstract + information is displayed in the page, but the is built using article's first 255 + characters. + + comments: A number representing how many comments the content + has received since it is in the database. + + The content itself is not displayed in the resumen, but in + `content_details()'. + + """ + title = self.tag_a({'href': qs_args({'app':'', 'p':'entry', 'id':id})}, [0,0], title) + title = self.tag_h3({'class': 'title'}, [20,1], title, 0) + info = self.content_info(id, user_id, commit_date, + update_date, category_id, comments, + abstract) + return self.tag_div(attrs, [16,1], title + info, 1) + + + def pagination(self): + """Return content pagination.""" + previous = self.tag_a({'href':''}, [0,0], 'Previous') + previous = self.tag_span({'class':'previous'}, [20,1], previous) + next = self.tag_a({'href':''}, [0,0], 'Next') + next = self.tag_span({'class':'next'}, [20,1], next) + separator = self.separator({'class':'page-line'}, [20,1]) + return self.tag_div({'class':'pagination'}, [16,1], previous + + next + separator, 1) + + + def content_info(self, content_id, user_id, commit_date, + update_date, category_id, comments, abstract): + """Return content information. + + The content information provides a reduced view of content so + people can make themselves an idea of what the content talks + about. The content information displays content's title, + author, timestamp, related category, number of comments and an + abstract of the whole content. + + """ + categories = [] + categories.append('Unknown') + categories.append('Erratas') + categories.append('Articles') + categories.append('Events') + + if category_id <= len(categories): + category_name = categories[category_id].capitalize() + else: + category_id = 0 + category_name = categories[category_id].capitalize() + + category_name = self.tag_a({'href': qs_args({'app':'', 'p':'categories', 'id':category_id})}, [0,0], category_name) + category_name = self.tag_span({'class':'category'}, [24,1], category_name) + + users = {} + users['al@centos.org'] = 'Alain Reguera Delgado' + users['ana@centos.org'] = 'Ana Tamara Reguera Gattorno' + users['alina@centos.org'] = 'Alina Reguera Gattorno' + + if user_id in users.keys(): + user_name = self.tag_a({'href':'mailto:' + user_id}, [0,0], users[user_id]) + user_name = self.tag_span({'class':'author'}, [24,1], 'Written by ' + user_name) + + if update_date != commit_date: + date = self.tag_span({'class':'date'}, [24,1], update_date) + else: + date = self.tag_span({'class':'date'}, [24,1], commit_date) + + + comments_attrs = {'href': qs_args({'app':'', 'p':'entry', 'id':content_id}) + '#comments'} + if comments == 1: + comments = self.tag_a(comments_attrs, [0,0], str(comments) + ' comment') + elif comments > 1: + comments = self.tag_a(comments_attrs, [0,0], str(comments) + ' comments') + else: + comments = 'No comments' + comments = self.tag_span({'class':'comment'}, [24,1], comments) + + abstract = self.tag_p({'class':'abstract'}, [24,1], abstract) + + return self.tag_div({'class': 'info'}, [20,1], user_name + date + category_name + comments + abstract, 1) + + + def content_list(self): + """Return list of content. + + The list of content is used to explore the content available + inside specific pages of specific web applications. The + information is displayed through paginated rows of content + that can be filtered to reduce the search results based on + patterns. By default, the list of content displays 15 rows, + but this value can be changed in user's preferences. + + """ + output = '' + count = 0 + rows = [] + rows.append([0, 'Introduction to CentOS Web Environment', + 'al@centos.org', + '2011-8-30 12:33:11', + '2011-8-30 12:33:11', + 0, + 0, + 'This is the abstract paragrah of content. '*10]) + rows.append([1, 'Creating New Applications', + 'al@centos.org', + '2011-8-30 12:33:11', + '2011-8-30 12:33:11', + 2, + 1, + 'This is the abstract paragrah of content. '*5]) + rows.append([2, 'Texinfo Documentation Backend', + 'al@centos.org', + '2011-8-30 12:33:11', + '2011-8-30 12:33:11', + 1, + 5, + 'This is the abstract paragrah of content. '*8]) + + for row in rows: + if count == 0: + attrs = {'class': 'dark row'} + count += 1 + else: + attrs = {'class': 'light row'} + count = 0 + output += self.content_resumen(attrs, *row) + + list = output + self.pagination() + self.separator() + list = self.tag_div({'id':'content-list'}, [12,1], list, 1) + actions = self.searchform() + self.categories() + self.archives() + actions = self.tag_div({'id':'content-actions'}, [8,1], actions, 1) + + return actions + list + + + def content_details(self): + """Return content details. + + The content detail is shown for contents and pages. + """ + output = '' + rows = [] + rows.append([0, 'Introduction to CentOS Web Environment', + 'al@centos.org', + '2011-8-30 12:33:11', + '2011-8-30 12:33:11', + 0, + 0, + 'This is the abstract paragrah of content. '*10, + 'This is the first paragraph of content'*10 + "\n" + 'This is the second paragraph of content'*20 + + "\n" + 'This is the third paragraph of content.'*10 + "\n"]) + rows.append([1, 'Creating New Applications', + 'al@centos.org', + '2011-8-30 12:33:11', + '2011-8-30 12:33:11', + 2, + 1, + 'This is the abstract paragrah of content. '*5, + "This is the first paragraph of content\n\ + This is the second paragraph of content.\n\ + This is the third paragraph of content."]) + rows.append([2, 'Texinfo Documentation Backend', + 'al@centos.org', + '2011-8-30 12:33:11', + '2011-8-30 12:33:11', + 1, + 5, + 'This is the abstract paragrah of content. '*8, + "This is the first paragraph of content.\n\ + This is the second paragraph of content.\n\ + This is the third paragraph of content."]) + + if 'id' in qs: + id = int(qs['id'][0]) + title = rows[id][1] + email = rows[id][2] + commit_date = rows[id][3] + update_date = rows[id][4] + category = rows[id][5] + comments = rows[id][6] + abstract = self.tag_p({}, [0,0], rows[id][7]) + + output = self.tag_h1({'class':'title'}, [12,1], title) + output += self.content_info(id, email, commit_date, update_date, category, comments, abstract) + output += self.tag_p({}, [20,1], rows[id][8]) + output += self.comments() + + return self.tag_div({'id':'content-details'}, [12,1], output, 1) + + + def comments(self): + """Returns content specific list of comments. + + """ + output = self.tag_a({'name':'comments'}, [0,0], 'Comments') + output = self.tag_h2({'class':'title comments'}, [12,1], output, 0) + + return output + + + def categories(self): + """Returns list of categories. + + """ + categories = ['Unknown', 'Articles', 'Erratas', 'Events'] + dt = self.tag_dt({}, [16,1], 'Categories') + dd = '' + for id in range(len(categories)): + category_attrs = {'href': qs_args({'app':'', 'p':'categories', 'id':id})} + a = self.tag_a(category_attrs, [0,0], categories[id] + ' (0)') + dd += self.tag_dd({}, [16,1], a) + + return self.tag_dl({},[12,1], dt + dd, 1) + + + def archives(self): + """Returns archives.""" + archives = {} + archives['2011'] = ['January', 'February', 'March', 'April', 'May'] + archives['2010'] = ['January', 'February'] + + dt = self.tag_dt({}, [16,1], 'Archives') + year_dl = '' + year_dd = '' + + for key in archives.keys(): + year_dt = self.tag_dt({},[20,1], key) + for id in range(len(archives[key])): + a = self.tag_a({'href': qs_args({'app':'', 'p':'archives', 'year': key, 'month': id + 1})}, [0,0], archives[key][id] + ' (0)') + year_dd += self.tag_dd({}, [20,1], a) + year_dl += self.tag_dl({'class':'year'}, [16,1], year_dt + year_dd, 1) + year_dd = '' + + return self.tag_dl({},[12,1], dt + year_dl, 1) + + + def page_top(self): + """Returns page top anchor.""" + return self.tag_a({'name':'top'}, [0,1]) + + + def page_header(self): + """Returns page header. + + The page_header is common to all application modules and + """ + return self.tag_div({'id': 'page-header'}, [4,1], self.header, 1) + + + def page_body(self): + """Returns page body. + + The page_body is specific to each application module and is + there where it must be constructed. The construction itself + takes place through the `page_content()' function which does a + return through an instantiated `content_' prefixed method. + The `content_' prefixed method used depends on the kind of + content you want to print out (e.g., `content_list()' for a + content list, `detail()' for a detailed view of content, + etc.). Later, the `body' variable instantiated from this class + is reset in the `main()' function with the value returned from + `page_content()' so the desired content layout can be printed + out. + + """ + return self.tag_div({'id':'page-body'}, [4,1], self.body, 1) + + + def page_links(self): + """Returns page links.""" + page_links = self.user_links() + return self.tag_div({'id': 'pagelinks'}, [8,1], page_links, 1) + + + def page_footer(self): + """Retruns page footer.""" + return self.tag_div({'id': 'page-footer'}, [4,1], self.credits(), 1) + + + def page_wrap(self): + """Returns page wrap.""" + return self.tag_div({'id': 'wrap'}, [0,1], self.page_header() + self.page_body() + self.page_footer(), 1) + + + def admonition(self, title='Note', subtitle="", body=""): + """Returns page admonition. + + title: Admonition's title. + + subtitle: Admonition's subtitle. The value of this argument is + concatenated on the right side of title using a colon (:) + as separator. Notice that this value is expanded inside + the

    tag and there is no need to introduce extra tags + here. + + body: Admonition's body. The values passed through this + arguments needs to be XHTML code returned from + `self.tag()'. Preferably, paragraphs (p), tables (table), + lists (ul, ol, dl) and pre-formatted texts (pre). + + """ + if title == '': + return '' + else: + title = str(title.capitalize()) + + if subtitle != '': + subtitle = ': ' + str(subtitle.capitalize()) + + if body != '': + body = str(body) + + admonitions = ['Note', 'Tip', 'Important', 'Caution', 'Warning', 'Redirected', 'Success', 'Error'] + + if title in admonitions: + attrs = {'class': 'admonition ' + title.lower()} + image = self.tag_img({'src': '/webenv-pub/Images/' + title.lower() + '.png', 'alt': title}, [16,1]) + title = self.tag_h3({'class': 'title'}, [16,1], title + subtitle, 0) + output = image + title + body + self.separator() + else: + attrs = {'class': 'admonition unknown'} + title = self.tag_h3({'class': 'title'}, [16,1], title + subtitle, 1) + output = title + body + + return self.tag_div(attrs, [12,1], output, 1) + + + def credits(self): + """Returns page credits.""" + copyright = self.tag_p({'class': 'copyright'}, [12,1], 'Copyright © ' + str(self.copyright)) + license = self.tag_p({'class': 'license'}, [12,1], 'This website is licensed under a ' + str(self.license())) + credits = self.tag_img({'src': '/webenv-pub/Images/top.png', 'alt': 'Top'}, [0,0]) + credits = self.tag_a({'title': 'Top', 'href': '#top'}, [16,1], credits) + credits = self.tag_div({'class': 'top'}, [12,1], credits, 1) + credits = str(credits) + str(copyright) + str(license) + credits = self.tag_div({'class': 'credits'}, [8,1], credits, 1) + + return credits + + + def page(self): + """Returns page final output.""" + html = self.doctype() + html += self.tag_html({'xmlns': 'http://www.w3.org/1999/xhtml', 'dir': 'ltr', + 'lang': str(self.language), 'xml:lang': str(self.language)}, [0,1], + self.metadata() + self.page_top() + self.page_wrap()) + + return html diff --git a/Scripts/Python/Webenv/Apps/xhtml.py b/Scripts/Python/Webenv/Apps/xhtml.py new file mode 100755 index 0000000..be646b5 --- /dev/null +++ b/Scripts/Python/Webenv/Apps/xhtml.py @@ -0,0 +1,1451 @@ +# Copyright (C) 2011 The CentOS Project +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ------------------------------------------------------------------ +# $Id$ +# ------------------------------------------------------------------ +"""Support XHTML construction. + +XHTML construction, as set here, uses the Extensible HTML version 1.0 +DTDs (/usr/share/sgml/xhtml1/xhtml1-20020801/DTD/) as reference. XHTML +construction is required by page module. +""" + + +class Strict: + """Implements XHTML strict document type definition.""" + + + # Core attributes common to most elements. + coreattrs = ['id', # document-wide unique id + 'class', # space separated list of classes + 'style', # associated style info + 'title' # advisory title/amplification + ] + + # Internationalization attributes. + i18n = ['lang', # language code (backwards compatible) + 'xml:lang', # language code (as per XML 1.0 spec) + 'dir' # direction for weak/neutral text + ] + + # Attributes for common UI events. + events = ['onclick', # a pointer button was clicked + 'ondblclick', # a pointer button was double clicked + 'onmousedown', # a pointer button was pressed down + 'onmouseup', # a pointer button was released + 'onmousemove', # a pointer was moved onto the element + 'onmouseout', # a pointer was moved away from the element + 'onkeypress', # a key was pressed and released + 'onkeydown', # a key was pressed down + 'onkeyup' # a key was released + ] + + # Attributes for elements that can get the focus. + focus = ['accesskey', # accessibility key character + 'tabindex', # position in tabbing order + 'onfocus', # the element got the focus + 'onblur' # the element lost the focus + ] + + # Attributes generic format. + attrs = coreattrs + i18n + events + + + def __init__(self): + """Initialize class data.""" + pass + + + def tag(self, name, attrs, indent=[8,1], content="", has_child=0): + """Returns generic XHTML tag definition. + + Arguments: + + name: The XHTML tag's name. Notice that this function doesn't + verify nor validate the XHTML tags you provide. It is up + to you write them correctly considering the XHTML standard + definition. + + attrs: The XHTML tag's attribute. Notice that this function + doesn't verify the attributes assignation to tags. You + need to know what attributes are considered valid to the + tag you are creating in order to build a well-formed XHTML + document. Such verification can be achived inside firefox + browser through the `firebug' plugin. + + indent: The XHTML tag's indentation (Optional). This argument + is a list of two numerical values. The first value in the + list represents the amount of horizontal spaces between + the beginning of line and the opening tag. The second + value in the list represents the amount of vertical spaces + (new lines) between tags. + + content: The XHTML tag's content (Optional). This argument + provides the information the tag encloses. When this + argument is empty, tag is rendered without content. + + has_child: The XHTML tag has a child? (Optional). This + argument is specifies whether a tag has another tag inside + (1) or not (0). When a tag has not a child tag, + indentation is applied between the tag content and the + closing tag provoking an unecessary spaces to be shown. + Such kind of problems are prevented by setting this option + to `0'. On the other hand, when a tag has a child tag + inside, using the value `1' will keep the closing tag + indentation aligned with the opening one. + + This function encapsulates the construction of XHTML tags. + Use this function wherever you need to create XHTML tags. It + helps to standardize tag constructions and their final output + and. This function provides a consistent way of producing + output for XHTML documents. + """ + if indent[0] > 0: + h_indent = ' '*indent[0] + else: + h_indent = '' + + if indent[1] > 0: + v_indent = "\n"*indent[1] + else: + v_indent = '' + + output = v_indent + h_indent + '<' + str(name) + if len(attrs) > 0: + attr_names = attrs.keys() + attr_names.sort() + for attr_name in attr_names: + output += ' ' + str(attr_name) + '="' + str(attrs[attr_name]) + '"' + if content == '': + output += ' />' + else: + output += '>' + output += str(content) + if has_child == 1: + output += h_indent + '' + else: + output += '' + output += v_indent + + return output + + + # ------------------------------------------------------------------ + # Document Type Definition + # ------------------------------------------------------------------ + + def doctype(self): + """Return document type definition.""" + output = '' + "\n" + output += '' + "\n" + + return output + + + # ------------------------------------------------------------------ + # Document Structure + # ------------------------------------------------------------------ + + def tag_html(self, attrs, indent, content, has_child=1): + """Returns document structure definition. + + + + + The namespace URI designates the document profile. + + """ + return self.tag('html', attrs, indent, content, has_child=1) + + + # ------------------------------------------------------------------ + # Document Head + # ------------------------------------------------------------------ + + def tag_head(self, attrs, indent, content, has_child=1): + """Returns document head definition. + + + + + + + Content model is %head.misc; combined with a single title and + an optional base element in any order. + + """ + return self.tag('head', attrs, indent, content, has_child) + + + def tag_title(self, attrs, indent, content, has_child=0): + """Returns title definition. + + + + + The title element is not considered part of the flow of text. + It should be displayed, for example as the page header or + window title. Exactly one title is required per document. + + """ + return self.tag('title', attrs, indent, content, has_child) + + + def tag_base(self, attrs, indent): + """Returns document base URI. + + + + + """ + return self.tag('base', attrs, indent) + + + def tag_meta(self, attrs, indent): + """Returns generic metainformation. + + + + + """ + return self.tag('meta', attrs, indent) + + + def tag_link(self, attrs, indent): + """Returns relationship values. + + + + + Relationship values can be used in principle: + + a) for document specific toolbars/menus when used with the + link element in document head e.g. start, contents, + previous, next, index, end, help. + + b) to link to a separate style sheet (rel="stylesheet"). + + c) to make a link to a script (rel="script"). + + d) by stylesheets to control how collections of html nodes + are rendered into printed documents. + + e) to make a link to a printable version of this document + e.g. a PostScript or PDF version (rel="alternate" + media="print"). + + """ + return self.tag('link', attrs, indent) + + + def tag_style(self, attrs, indent, content, has_child=0): + """Returns style info. + + + + + """ + return self.tag('style', attrs, indent, content, has_child) + + + def tag_script(self, attrs, indent, content="", has_child=0): + """Returns script statement. + + + + + + """ + return self.tag('script', attrs, indent, content, has_child) + + + def tag_noscript(self, attrs, indent, content, has_child=1): + """Returns alternate content container for non script-based + rendering. + + + + + """ + return self.tag(self, attrs, indent, content, has_child) + + + # ------------------------------------------------------------------ + # Document Body + # ------------------------------------------------------------------ + + def tag_body(self, attrs, indent, content, has_child=1): + """Returns document body definition. + + + + + """ + return self.tag('body', attrs, indent, content, has_child) + + + def tag_div(self, attrs, indent, content, has_child=0): + """Returns generic language/style container. + + + + + """ + return self.tag('div', attrs, indent, content, has_child) + + + # ------------------------------------------------------------------ + # Paragraphs + # ------------------------------------------------------------------ + + def tag_p(self, attrs, indent, content, has_child=0): + """Returns paragraph definition. + + + + + When content is introduced inside the database, it goes + without any XHTML markup. This method transforms newline + separated strings into XHTML paragraphs. + + """ + output = '' + for line in content.splitlines(): + if line == '': continue + output += self.tag('p', attrs, indent, line.strip(), has_child) + return output + + + # ------------------------------------------------------------------ + # Headings + # ------------------------------------------------------------------ + # There are six levels of headings from h1 (the most important) to + # h6 (the least important). + # ------------------------------------------------------------------ + + def tag_h1(self, attrs, indent, content, has_child=0): + """Returns h1 definition. + + + + + """ + return self.tag('h1', attrs, indent, content, has_child) + + + def tag_h2(self, attrs, indent, content, has_child=0): + """Returns h2 definition. + + + + + """ + return self.tag('h2', attrs, indent, content, has_child) + + + def tag_h3(self, attrs, indent, content, has_child): + """Returns h3 definition. + + + + + """ + return self.tag('h3', attrs, indent, content, has_child) + + + def tag_h4(self, attrs, indent, content, has_child): + """Returns h4 definition. + + + + + """ + return self.tag('h4', attrs, indent, content, has_child) + + + def tag_h5(self, attrs, indent, content, has_child=0): + """Returns h5 definition. + + + + + """ + return self.tag('h5', attrs, indent, content, has_child) + + + def tag_h6(self, attrs, indent, content, has_child=0): + """Returns h6 definition. + + + + + """ + return self.tag('h6', attrs, indent, content, has_child) + + + # ------------------------------------------------------------------ + # Lists + # ------------------------------------------------------------------ + + def tag_ul(self, attrs, indent, content, has_child=1): + """Returns unordered list definition. + + + + + """ + return self.tag('ul', attrs, indent, content, has_child) + + + def tag_ol(self, attrs, indent, content, has_child=1): + """Returns ordered (numbered) list definition. + + + + + """ + return self.tag('ol', attrs, indent, content, has_child) + + + def tag_li(self, attrs, indent, content, has_child=0): + """Returns item definition for both ordered (ol) and unordered + (ul) lists. + + + + + """ + return self.tag('li', attrs, indent, content, has_child) + + + def tag_dl(self, attrs, indent, content, has_child=1): + """Returns definition list definition. + + + + + """ + return self.tag('dl', attrs, indent, content, has_child) + + + def tag_dt(self, attrs, indent, content, has_child=0): + """Returns term of definition lists. + + + + + """ + return self.tag('dt', attrs, indent, content, has_child) + + + def tag_dd(self, attrs, indent, content, has_child=0): + """Returns definition of definition lists. + + + + + """ + return self.tag('dd', attrs, indent, content, has_child) + + + # ------------------------------------------------------------------ + # Address + # ------------------------------------------------------------------ + + def tag_address(self, attrs, indent, content='', has_child=0): + """Returns information on author. + + + + + """ + return self.tag('address', attrs, indent, content) + + + # ------------------------------------------------------------------ + # Horizontal Rule + # ------------------------------------------------------------------ + + def tag_hr(self, attrs, indent): + """Returns horizontal rule. + + + + + """ + return self.tag('hr', attrs, indent) + + + # ------------------------------------------------------------------ + # Preformatted text + # ------------------------------------------------------------------ + + def tag_pre(self, attrs, indent, content): + """Returns preformatted text. + + + + + content is %Inline; excluding "img|object|big|small|sub|sup" + + """ + return self.tag('pre', attrs, indent, content) + + + # ------------------------------------------------------------------ + # Block-line Quotes + # ------------------------------------------------------------------ + + def tag_blockquote(self, attrs, indent, content): + """Returns block-line quote. + + + + + """ + return self.tag('blockquote', attrs, indent, content) + + + # ------------------------------------------------------------------ + # Inserted/Deleted Text + # ------------------------------------------------------------------ + + def tag_ins(self, attrs, indent, content): + """Returns inserted text. + + + + + Inserted texts are allowed in block and inline content, but + its inappropriate to include block content within an ins + element occurring in inline content. + + """ + return self.tag('ins', attrs, indent, content) + + + def tag_del(self, attrs, indent, content): + """Returns deleted text. + + + + + Deleted texts are allowed in block and inline content, but its + inappropriate to include block content within an ins element + occurring in inline content. + + """ + return self.tag('ins', attrs, indent, content) + + + # ------------------------------------------------------------------ + # The Anchor Element + # ------------------------------------------------------------------ + + def tag_a(self, attrs, indent, content='', has_child=0): + """Returns the anchor element. + + + + + content is %Inline; except that anchors shouldn't be nested. + """ + return self.tag('a', attrs, indent, content, has_child) + + + # ------------------------------------------------------------------ + # Inline Elements + # ------------------------------------------------------------------ + + def tag_span(self, attrs, indent, content, has_child=0): + """Returns span definition. + + + + + """ + return self.tag('span', attrs, indent, content, has_child) + + + def tag_dbo(self, attrs, indent, content, has_child=0): + """Returns dbo definition. + + + + + """ + return self.tag('dbo', attrs, indent, content, has_child) + + + def tag_br(self, attrs, indent): + """Returns break definition. + + + + + """ + return self.tag('br', attrs, indent) + + + def tag_em(self, attrs, indent, content, has_child=0): + """Returns emphasis definition. + + + + + """ + return self.tag('em', attrs, indent, content, has_child) + + + def tag_strong(self, attrs, indent, content, has_child=0): + """Returns strong emphasis definition. + + + + + """ + return self.tag('strong', attrs, indent, content, has_child) + + + def tag_dfn(self, attrs, indent, content, has_child=0): + """Returns definitional definition. + + + + + """ + return self.tag('dfn', attrs, indent, content, has_child) + + + def tag_code(self, attrs, indent, content, has_child=0): + """Returns program code definition. + + + + + """ + return self.tag('code', attrs, indent, content, has_child) + + + def tag_samp(self, attrs, indent, content, has_child=0): + """Returns sample definition. + + + + + """ + return self.tag('samp', attrs, indent, content, has_child) + + + def tag_kbd(self, attrs, indent, content, has_child=0): + """Returns definition for something user would type. + + + + + """ + return self.tag('kbd', attrs, indent, content, has_child) + + + def tag_var(self, attrs, indent, content, has_child=0): + """Returns variable definition. + + + + + """ + return self.tag('var', attrs, indent, content, has_child) + + + def tag_cite(self, attrs, indent, content, has_child=0): + """Returns citation definition. + + + + + """ + return self.tag('cite', attrs, indent, content, has_child) + + + def tag_abbr(self, attrs, indent, content, has_child=0): + """Returns abbreviation definition. + + + + + """ + return self.tag('abbr', attrs, indent, content, has_child) + + + def tag_acronym(self, attrs, indent, content, has_child=0): + """Returns the acronym definition. + + + + + """ + return self.tag('acronym', attrs, indent, content, has_child) + + + def tag_q(self, attrs, indent, content, has_child=0): + """Returns inline quote definition. + + + + + """ + return self.tag('q', attrs, indent, content, has_child) + + + def tag_sub(self, attrs, indent, content, has_child=0): + """Returns subscript definition. + + + + + """ + return self.tag('sub', attrs, indent, content, has_child) + + + def tag_sup(self, attrs, indent, content, has_child=0): + """Returns superscript definition. + + + + + """ + return self.tag('sup', attrs, indent, content, has_child) + + + def tag_tt(self, attrs, indent, content, has_child=0): + """Returns fixed pitch font definition. + + + + + """ + return self.tag('tt', attrs, indent, content, has_child) + + + def tag_i(self, attrs, indent, content, has_child=0): + """Returns italic font definition. + + + + + """ + return self.tag('i', attrs, indent, content, has_child) + + + def tag_b(self, attrs, indent, content, has_child=0): + """Returns bold font definition. + + + + + """ + return self.tag('b', attrs, indent, content, has_child) + + + def tag_big(self, attrs, indent, content, has_child=0): + """Returns bigger font definition. + + + + + """ + return self.tag('big', attrs, indent, content, has_child) + + + def tag_small(self, attrs, indent, content, has_child=0): + """Returns smaller font definition. + + + + + """ + return self.tag('small', attrs, indent, content, has_child) + + + # ------------------------------------------------------------------ + # Object + # ------------------------------------------------------------------ + + def tag_object(self, attrs, indent, content, has_child=1): + """Returns object definition. + + + + + The object definition is used to embed objects as part of HTML + pages. param elements should precede other content. + Parameters can also be expressed as attribute/value pairs on + the object element itself when brevity is desired. + + """ + return self.tag('object', attrs, indent, content, has_child) + + + def tag_param(self, attrs, indent): + """Returns param definition. + + + + + The param definition is used to supply a named property value. + In XML it would seem natural to follow RDF and support an + abbreviated syntax where the param elements are replaced by + attribute value pairs on the object start tag. + + """ + return self.tag('object', attrs, indent) + + + # ------------------------------------------------------------------ + # Images + # ------------------------------------------------------------------ + + def tag_img(self, attrs, indent): + """Returns image definition. + + + + + To avoid accessibility problems for people who aren't able to + see the image, you should provide a text description using the + alt and longdesc attributes. In addition, avoid the use of + server-side image maps. Note that in this DTD there is no + name attribute. That is only available in the transitional + and frameset DTD. + + usemap points to a map element which may be in this document + or an external document, although the latter is not widely + supported. + + """ + return self.tag('img', attrs, indent) + + + # ------------------------------------------------------------------ + # Client-side image maps + # ------------------------------------------------------------------ + + def tag_map(self, attrs, indent, content, has_child=1): + """Returns map definition. + + + + + This can be placed in the same document or grouped in a + separate document although this isn't yet widely supported. + + """ + return self.tag('map', attrs, indent, indent, content, has_child) + + + def tag_area(self, attrs, indent): + """Returns area definition. + + + + + This can be placed in the same document or grouped in a + separate document although this isn't yet widely supported. + + """ + return self.tag('area', attrs, indent) + + + # ------------------------------------------------------------------ + # Forms + # ------------------------------------------------------------------ + + def tag_form(self, attrs, indent, content, has_child=1): + """Returns form definition. + + + + + """ + return self.tag('form', attrs, indent, content, has_child) + + + def tag_label(self, attrs, indent, content, has_child=0): + """Returns label definition. + + + + + Each label must not contain more than ONE field Label elements + shouldn't be nested. + + """ + return self.tag('label', attrs, indent, content, has_child) + + + def tag_input(self, attrs, indent): + """Returns input definition for form control. + + + + + + + The name attribute is required for all but submit & reset. + + """ + return self.tag('input', attrs, indent) + + + def tag_select(self, attrs, indent, content, has_child=0): + """Returns select definition. + + + + + """ + return self.tag('select', attrs, indent, content, has_child) + + + def tag_optgroup(self, attrs, indent, content, has_child=1): + """Returns option group definition. + + + + + """ + return self.tag('optgroup', attrs, indent, content, has_child) + + + def tag_option(self, attrs, indent, content, has_child=0): + """Returns option definition. + + + + + """ + return self.tag('option', attrs, indent, content, has_child) + + + def tag_textarea(self, attrs, indent, content): + """Returns textarea definition. + + + + + """ + return self.textarea('textarea', attrs, indent, content) + + + def tag_fieldset(self, attrs, indent, content, has_child=1): + """Returns fieldset definition. + + + + + The fieldset element is used to group form fields. Only one + legend element should occur in the content and if present + should only be preceded by whitespace. + + """ + return self.tag('filedset', attrs, indent, content, has_child) + + + def tag_legend(self, attrs, indent, content): + """Retruns legend definition. + + + + + """ + return self.tag('legend', attrs, indent, content) + + + def tag_button(self, attrs, indent, content): + """Returns button definition. + + + + + content is %Flow; excluding a, form and form controls. + + """ + return self.tag('button', attrs, indent, content) + + + def tag_table(self, attrs, indent, content, has_child=1): + """Returns table definition. + + + + + + + + + + + Derived from IETF HTML table standard, see [RFC1942] + + The border attribute sets the thickness of the frame around + the table. The default units are screen pixels. The frame + attribute specifies which parts of the frame around the table + should be rendered. The values are not the same as CALS to + avoid a name clash with the valign attribute. The rules + attribute defines which rules to draw between cells: If rules + is absent then assume: "none" if border is absent or + border="0" otherwise "all". Horizontal alignment attributes + for cell contents: + char alignment char, e.g. char=':' + charoff offset for alignment char + + """ + return self.tag('table', attrs, indent, content, has_child) + + + def tag_caption(self, attrs, indent, content): + """Returns caption definition. + + + + + """ + return self.tag('caption', attrs, indent, content) + + + def tag_thead(self, attrs, indent, content, has_child=1): + """Returns thead definition. + + + + + Use thead to duplicate headers when breaking table across page + boundaries, or for static headers when tbody sections are + rendered in scrolling panel. + + """ + return self.tag('thead', attrs, indent, content, has_child) + + + def tag_tbody(self, attrs, indent, content, has_child=1): + """Returns tbody definition. + + + + + Use tbody to duplicate footers when breaking table across page + boundaries, or for static footers when tbody sections are + rendered in scrolling panel. + + """ + return self.tag('tbody', attrs, indent, content, has_child) + + + def tag_tbody(self, attrs, indent, content, has_child=1): + """Returns tbody definition. + + + + + Use multiple tbody sections when rules are needed between + groups of table rows. + + """ + return self.tag('tbody', attrs, indent, content, has_child) + + + def tag_colgroup(self, attrs, indent, content, has_child=1): + """Returns colgroup definition. + + + + + colgroup groups a set of col elements. It allows you to group + several semantically related columns together. + + """ + return self.tag('colgroup', attrs, indent, content, has_child) + + + def tag_col(self, attrs, indent): + """Returns col definition. + + + + + col elements define the alignment properties for cells in one + or more columns. The width attribute specifies the width of + the columns, e.g. + + width=64 width in screen pixels + width=0.5* relative width of 0.5 + + The span attribute causes the attributes of one col element to + apply to more than one column. + + """ + return self.tag('col', attrs, indent) + + + def tag_tr(self, attrs, indent, content, has_child=1): + """Returns table row definition. + + + + + """ + return self.tag('tr', attrs, indent, content, has_child) + + + def tag_th(self, attrs, indent, content, has_child): + """Returns table header definition. + + + + + + + Scope is simpler than headers attribute for common tables. th + is for headers, td for data and for cells acting as both. + + """ + return self.tab('th', attrs, indent, content, has_child) + + + def tag_td(self, attrs, indent, content, has_child=1): + """Returns table data definition. + + + + + """ + return self.tag('td', attrs, indent, content, has_child) diff --git a/Scripts/Python/Webenv/Public/Images/a-attach.png b/Scripts/Python/Webenv/Public/Images/a-attach.png new file mode 100644 index 0000000..d6a41e7 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/a-attach.png differ diff --git a/Scripts/Python/Webenv/Public/Images/a-mail.png b/Scripts/Python/Webenv/Public/Images/a-mail.png new file mode 100644 index 0000000..355a998 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/a-mail.png differ diff --git a/Scripts/Python/Webenv/Public/Images/a-www.png b/Scripts/Python/Webenv/Public/Images/a-www.png new file mode 100644 index 0000000..e5a0483 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/a-www.png differ diff --git a/Scripts/Python/Webenv/Public/Images/ads-sample-468x60.png b/Scripts/Python/Webenv/Public/Images/ads-sample-468x60.png new file mode 100644 index 0000000..f634d10 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/ads-sample-468x60.png differ diff --git a/Scripts/Python/Webenv/Public/Images/ads-sample-728x90.png b/Scripts/Python/Webenv/Public/Images/ads-sample-728x90.png new file mode 100644 index 0000000..5401e60 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/ads-sample-728x90.png differ diff --git a/Scripts/Python/Webenv/Public/Images/caution.png b/Scripts/Python/Webenv/Public/Images/caution.png new file mode 100644 index 0000000..efcec04 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/caution.png differ diff --git a/Scripts/Python/Webenv/Public/Images/centos-logo.png b/Scripts/Python/Webenv/Public/Images/centos-logo.png new file mode 100644 index 0000000..506c65d Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/centos-logo.png differ diff --git a/Scripts/Python/Webenv/Public/Images/convenction.png b/Scripts/Python/Webenv/Public/Images/convenction.png new file mode 100644 index 0000000..e516c0e Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/convenction.png differ diff --git a/Scripts/Python/Webenv/Public/Images/error.png b/Scripts/Python/Webenv/Public/Images/error.png new file mode 100644 index 0000000..0f52b4d Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/error.png differ diff --git a/Scripts/Python/Webenv/Public/Images/h1-bg.png b/Scripts/Python/Webenv/Public/Images/h1-bg.png new file mode 100644 index 0000000..e609c59 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/h1-bg.png differ diff --git a/Scripts/Python/Webenv/Public/Images/h2-bg.png b/Scripts/Python/Webenv/Public/Images/h2-bg.png new file mode 100644 index 0000000..826fbec Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/h2-bg.png differ diff --git a/Scripts/Python/Webenv/Public/Images/html-bg.png b/Scripts/Python/Webenv/Public/Images/html-bg.png new file mode 100644 index 0000000..0c6dca6 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/html-bg.png differ diff --git a/Scripts/Python/Webenv/Public/Images/important.png b/Scripts/Python/Webenv/Public/Images/important.png new file mode 100644 index 0000000..509ec86 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/important.png differ diff --git a/Scripts/Python/Webenv/Public/Images/msg-bg-blue.png b/Scripts/Python/Webenv/Public/Images/msg-bg-blue.png new file mode 100644 index 0000000..47bc405 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/msg-bg-blue.png differ diff --git a/Scripts/Python/Webenv/Public/Images/msg-bg-gray.png b/Scripts/Python/Webenv/Public/Images/msg-bg-gray.png new file mode 100644 index 0000000..a8a9246 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/msg-bg-gray.png differ diff --git a/Scripts/Python/Webenv/Public/Images/msg-bg-green.png b/Scripts/Python/Webenv/Public/Images/msg-bg-green.png new file mode 100644 index 0000000..f1bfe2b Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/msg-bg-green.png differ diff --git a/Scripts/Python/Webenv/Public/Images/msg-bg-orange.png b/Scripts/Python/Webenv/Public/Images/msg-bg-orange.png new file mode 100644 index 0000000..0866bb8 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/msg-bg-orange.png differ diff --git a/Scripts/Python/Webenv/Public/Images/msg-bg-red.png b/Scripts/Python/Webenv/Public/Images/msg-bg-red.png new file mode 100644 index 0000000..2dc3e70 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/msg-bg-red.png differ diff --git a/Scripts/Python/Webenv/Public/Images/msg-bg-violet.png b/Scripts/Python/Webenv/Public/Images/msg-bg-violet.png new file mode 100644 index 0000000..8b1075d Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/msg-bg-violet.png differ diff --git a/Scripts/Python/Webenv/Public/Images/note.png b/Scripts/Python/Webenv/Public/Images/note.png new file mode 100644 index 0000000..b58a224 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/note.png differ diff --git a/Scripts/Python/Webenv/Public/Images/redirect.png b/Scripts/Python/Webenv/Public/Images/redirect.png new file mode 100644 index 0000000..16a8c41 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/redirect.png differ diff --git a/Scripts/Python/Webenv/Public/Images/success.png b/Scripts/Python/Webenv/Public/Images/success.png new file mode 100644 index 0000000..74cc874 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/success.png differ diff --git a/Scripts/Python/Webenv/Public/Images/tabs-bg-1.png b/Scripts/Python/Webenv/Public/Images/tabs-bg-1.png new file mode 100644 index 0000000..22cff37 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/tabs-bg-1.png differ diff --git a/Scripts/Python/Webenv/Public/Images/tabs-bg-2.png b/Scripts/Python/Webenv/Public/Images/tabs-bg-2.png new file mode 100644 index 0000000..5d8e178 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/tabs-bg-2.png differ diff --git a/Scripts/Python/Webenv/Public/Images/tip.png b/Scripts/Python/Webenv/Public/Images/tip.png new file mode 100644 index 0000000..cfcf6db Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/tip.png differ diff --git a/Scripts/Python/Webenv/Public/Images/top.png b/Scripts/Python/Webenv/Public/Images/top.png new file mode 100644 index 0000000..1557422 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/top.png differ diff --git a/Scripts/Python/Webenv/Public/Images/ul.png b/Scripts/Python/Webenv/Public/Images/ul.png new file mode 100644 index 0000000..efcf485 Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/ul.png differ diff --git a/Scripts/Python/Webenv/Public/Images/warning.png b/Scripts/Python/Webenv/Public/Images/warning.png new file mode 100644 index 0000000..e36c02a Binary files /dev/null and b/Scripts/Python/Webenv/Public/Images/warning.png differ diff --git a/Scripts/Python/Webenv/Public/Stylesheet/admonition.css b/Scripts/Python/Webenv/Public/Stylesheet/admonition.css new file mode 100755 index 0000000..be73065 --- /dev/null +++ b/Scripts/Python/Webenv/Public/Stylesheet/admonition.css @@ -0,0 +1,122 @@ +/* + * Webenv -> Quotation + * + * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG + * + * This CSS 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 CSS 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * ---------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------- + */ + +div#page-body div.admonition { + border: 1px solid; + border-left: 5px solid; + padding: 10px 20px 10px 10px; + margin: 1.5em 0 1.5em 0; + } + +div#page-body div.admonition pre { + border: none; + background-color: #333; + color: #FFFFFF; + } + +div#page-body div.admonition img { + float: left; + } + + +div#page-body div.admonition h3 { + margin-top: 10px; + line-height: 1.5em; + } + +div#page-body div.admonition h3, +div#page-body div.admonition p, +div#page-body div.admonition pre, +div#page-body div.admonition table { + margin-left: 60px; + } + +div#page-body div.admonition ul, +div#page-body div.admonition ol, +div#page-body div.admonition dl { + margin-left: 110px; + } + +div#page-body div.admonition ul dl, +div#page-body div.admonition ul ol, +div#page-body div.admonition ul ul, +div#page-body div.admonition ol dl, +div#page-body div.admonition ol ol, +div#page-body div.admonition ol ul, +div#page-body div.admonition dl dl, +div#page-body div.admonition dl ol, +div#page-body div.admonition dl ul { + margin-left: 2.5em; + } + +div#page-body div.admonition.unknown pre, +div#page-body div.admonition.unknown h3, +div#page-body div.admonition.unknown p, +div#page-body div.admonition.unknown table { + margin-left: 20px; + } + +div#page-body div.admonition.success, +div#page-body div.admonition.redirected, +div#page-body div.admonition.error { + border: none; + border-top: 5px solid; + border-bottom: 5px solid; + border-color: #CFCFCF; + } + +div#page-body div.admonition.unknown, +div#page-body div.admonition.redirected, +div#page-body div.admonition.note { + background-image: url("https://projects.centos.org/webenv-pub/Images/msg-bg-blue.png"); + border-color: #D2E0F6; + background-color: #ECF4FF; + } + +div#page-body div.admonition.tip, +div#page-body div.admonition.important, +div#page-body div.admonition.caution, +div#page-body div.admonition.warning { + border-color: #F6E7D2; + background-color: #FFF8EC; + background-image: url("https://projects.centos.org/webenv-pub/Images/msg-bg-orange.png"); + } + +div#page-body div.admonition.violet { + border-color: #F6D2F6; + background-color: #FFECFF; + background-image: url("https://projects.centos.org/webenv-pub/Images/msg-bg-violet.png"); + } + +div#page-body div.admonition.error { + border-color: #E0B7B7; + background-color: #FFECEC; + background-image: url("https://projects.centos.org/webenv-pub/Images/msg-bg-red.png"); + } + +div#page-body div.admonition.success { + border-color: #D6F6D2; + background-color: #EEFFEC; + background-image: url("https://projects.centos.org/webenv-pub/Images/msg-bg-green.png"); + } diff --git a/Scripts/Python/Webenv/Public/Stylesheet/base.css b/Scripts/Python/Webenv/Public/Stylesheet/base.css new file mode 100755 index 0000000..998909e --- /dev/null +++ b/Scripts/Python/Webenv/Public/Stylesheet/base.css @@ -0,0 +1,376 @@ +/* + * Webenv -> Main Blocks + * + * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG + * + * This CSS 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 CSS 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * ---------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------- + */ + +div#page-header, +div#wrap, +div#page-body, +div#page-footer { + min-width: 728px; + } + +/* Header +--------------------------------------------------------------------*/ +div#page-header { + background: #204C8D url("https://projects.centos.org/webenv-pub/Images/h1-bg.png") 0 0 repeat; + min-height: 46px; + } + +/* Content +--------------------------------------------------------------------*/ + +div#wrap { + padding: 0 10px 0 10px; + background-color: #FFF; + } + +div#page-body { + clear: both; + background-color: #F8F8F8; + } + +div#page-body div#content-list { + padding: 10px; + padding-left: 0; + padding-top: 8px; + background-color: #FFF; + } + +/* Paragraphs +--------------------------------------------------------------------*/ + +/* Footer +--------------------------------------------------------------------*/ + +div#page-footer { + background: #204C8D url("https://projects.centos.org/webenv-pub/Images/h1-bg.png") 0 0 repeat; + } + +div#page-footer div.credits { + padding: 8px; + } + +div#page-footer div.credits .copyright, +div#page-footer div.credits .license { + font-size: x-small; + color: #FFF; + margin: 3px; + } + +div#page-footer div.credits a { + color: #FFF; + font-style: italic; + } + +div#page-footer div.top { + float:right; + } + +/* Logo +--------------------------------------------------------------------*/ + +div#page-header div#logo img { + border: none; + float: left; + margin-left: 10px; + } + +/* Google advertisement (468x60px) +--------------------------------------------------------------------*/ + +div#page-header div.google-ad { + float: right; + margin: 5px; + } + +div#page-header div.google-ad img { + border: none; + } + +/* Last releases and related RSS link. +--------------------------------------------------------------------*/ + +div#page-header div#last-releases { + clear: both; + min-height: 35px; + border-top: 3px solid #FFF; + background: #3465A4; + } + +div#page-header div#last-releases a { + color: #fff; + } + +div#page-header div#last-releases div.left { + display: block; + float: left; + width: 450px; + margin-top: 10px; + margin-left: 10px; + font-size: small; + } + +div#page-header div#last-releases div.right { + float: right; + margin-top: 9px; + margin-right: 5px; + } + +div#page-header div#last-releases div.right span.rss span { + text-align: center; + font-weight: bold; + background: #729fcf; + padding: 4px 10px; + } + +div#page-header div#last-releases div span.title { + font-weight: bold; + color: #FFF; + } + +div#page-header div#last-releases div span.release { + border-right: 1px dotted #FFF; + padding-left: 10px; + padding-right: 10px; + font-weight: bold; + } + +div#page-header div#last-releases div span.last { + border-right: 0px; + } + +/* Application links +--------------------------------------------------------------------*/ + +div#page-header div#pagelinks { + border-top: 3px solid #FFF; + } + +/* User related links (e.g., last visit, session info and page trails) +--------------------------------------------------------------------*/ + +div#page-header div.userlinks { + padding: 10px; + text-align: right; + font-size: x-small; + clear: both; + } + +div#page-header div.userlinks a { + color: #fff; + } + +div#page-header div.userlinks div.logs { + width: 50%; + float: left; + text-align: left; + } + +div#page-header div.userlinks div.logs span { + border: none; + } + +div#page-header div.userlinks div.logs span.title { + color: #FFF; + } + +div#page-header div.userlinks div.logs span.datetime { + font-style: italic; + color: #FFF; + } + +div#page-header div.userlinks div.session { + width: 50%; + float: right; + } + +div#page-header div.userlinks div.session span { + border-right: 1px dotted #FFF; + } + +div#page-header div.userlinks div.session span a { + margin-right: 10px; + margin-left: 10px; + } + + +div#page-header div.userlinks div.session span.last { + border-right: none; + } + +div#page-header div.userlinks div.session span.last a { + margin-right: 0; + } + +div#page-header div.userlinks div.session span.last:after { + content: none; + } + +div#page-header div.userlinks div.trail { + text-align: right; + clear: both; + padding-top: 5px; + } + +div#page-header div.userlinks div.trail span { + display: inline; + } + +div#page-header div.userlinks div.trail span.last { + border-right: none; + padding-right: 0; + } + +div#page-header div.userlinks div.trail span:after { + content: "»"; + color: #FFF; + margin-left: 5px; + margin-right: 3px; + } + +div#page-header div.userlinks div.trail span.last:after { + content: none; + } + +/* Page lines. +--------------------------------------------------------------------*/ + +.page-line { + clear: both; + margin: 0; + padding: 0; + background-color: transparent; + } + +.page-line.white { + height: 3px; + background-color: #FFF; + } + +/* Page body +--------------------------------------------------------------------*/ + +div#page-body .info { + margin-top: 5px; + } + +div#page-body .info span { + font-size: small; + border-right: 1px dotted #AAA; + padding-right: 10px; + padding-left: 7px; + } + +div#page-body .info span.author { + padding-left: 0; + } + +div#page-body .info span.comment { + border-right: 0; + } + +/* Content Listing - One column +--------------------------------------------------------------------*/ + +div#page-body div#content-list { + margin-right: 200px; + border-right: 3px #EEE solid; + } + +div#page-body div#content-actions { + float:right; + width: 180px; + border-left: 3px #EEE solid; + padding: 10px; + font-size: small; + } + +div#page-body div#content-actions form input[type="text"] { + border: 1px solid #AAA; + } + +div#page-body div#content-list div.search { + } + +div#page-body div#content-list div.row { + padding: 10px 20px; + } + +div#page-body div#content-list div.dark { + background: #F8F8F8; + } + +div#page-body div#content-list div.light { + background: #FFF; + } + +div#page-body div#content-list h3.title { + margin-top: 0; + } + +div#page-body div#content-list .abstract { + margin-bottom: 1em; + } + +div#page-body div#content-list .pagination { + border-top: 1px solid #AAA; + font-size: small; + padding: 10px; + border-top: 1px #AAA solid; + margin-bottom: 0; + padding-bottom: 0; + } + +div#page-body div#content-list .pagination span.previous { + float: left; + } + +div#page-body div#content-list .pagination span.previous a:before { + content: "«"; + padding-right: 3px; + } + +div#page-body div#content-list .pagination span.next a:after { + content: "»"; + padding-left: 3px; + } + +div#page-body div#content-list .pagination span.next { + float: right; + } + +/* Content Details - One column +--------------------------------------------------------------------*/ + +div#page-body div#content-details { + padding: 30px 10% 30px 10%; + background: #FFF; + } + +/* Content Unkown - Not page found. +--------------------------------------------------------------------*/ + +div#page-body div#content-unknown { + padding: 0 15% 0 15%; + background: #FFF; + } diff --git a/Scripts/Python/Webenv/Public/Stylesheet/forms.css b/Scripts/Python/Webenv/Public/Stylesheet/forms.css new file mode 100755 index 0000000..9a39fc2 --- /dev/null +++ b/Scripts/Python/Webenv/Public/Stylesheet/forms.css @@ -0,0 +1,137 @@ +/* + * Webenv -> Forms + * + * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG + * + * This CSS 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 CSS 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * ---------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------- + */ + +div#page-body div.row1 { + clear: both; + background: #F8F8F8; + padding: 10px; + } + +div#page-body div.row2 { + clear: both; + background: #FFFFFF; + padding: 10px; + } + +div#page-body div.row3 { + clear: both; + border-top: 1px solid #CCC; + padding: 10px; + margin-top: 10px; + } + +div#page-body fieldset div.row1 span.descrip, +div#page-body fieldset div.row2 span.descrip { + float: left; + } + +div#page-body fieldset div.field { + display: block; + margin-left: 30%; + } + +div#page-body fieldset div.field div.column { + float: left; + margin-right: 1em; + padding-right: 1em; + border-right: 1px dotted #AAA; + } + +div#page-body fieldset div.row3 div.descrip { + display: block; + font-size: small; + color: #AAA; + font-style: italic; + width: 70% + } + +div#page-body fieldset span.submit { + float: right; + } + +/* */ + +div#page-body form div { + padding-bottom: 10px; + } + +div#page-body form div span { + display: inline; + margin: 0; + padding-right: 10px; + } + +div#page-body div span.results { + padding-left: 10px; + border-left: 1px dotted #AAA; + } + +/* */ + + +/* */ + +div#page-body div.records-list { + display: block; + } + +div#page-body div.records-list ul { + margin: 0; + padding: 0; + list-style: none; + } + +div#page-body div.records-list ul li { + padding: 0.5em; + } + +div#page-body div.records-list ul li.row1 { + background: #F8F8F8; + } + +div#page-body div.records-list ul li span.col0 { + display: block; + float:left; + text-align: center; + padding-right: 0.5em; + margin-right: 0.5em; + border-right: 1px solid #FFF; + } + +div#page-body div.records-list ul li span.col1 { + width: 250px; + display: block; + float:left; + } + +div#page-body div.records-list ul li span.col2 { + border-left: 1px solid #FFF; + padding-left: 0.5em; + } + +div#page-body div.records-list ul li.title { + font-weight: bold; + background: #eee; + border-bottom: 1px #AAA solid; + } diff --git a/Scripts/Python/Webenv/Public/Stylesheet/links.css b/Scripts/Python/Webenv/Public/Stylesheet/links.css new file mode 100755 index 0000000..d0ae637 --- /dev/null +++ b/Scripts/Python/Webenv/Public/Stylesheet/links.css @@ -0,0 +1,62 @@ +/* + * Webenv -> Links + * + * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG + * + * This CSS 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 CSS 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * ---------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------- + */ + +/* Broken or nonexistent links. +--------------------------------------------------------------------*/ + +div#page-body a.nonexistent, +div#page-body a.nonexistent:hover { color: gray; } + +/* Special decoration for some links' classes +--------------------------------------------------------------------*/ + +div#page-body a.www:before { + white-space:nowrap; + content: url(/home/centos/artwork/trunk/Identity/Images/Webenv/a-www.png); + margin: 0 0.2em; + } + +div#page-body a.http:before { + white-space:nowrap; + content: url(/home/centos/artwork/trunk/Identity/Images/Webenv/a-www.png); + margin: 0 0.2em; + } + +div#page-body a.https:before { + white-space:nowrap; + content: url(/home/centos/artwork/trunk/Identity/Images/Webenv/a-www.png); + margin: 0 0.2em; + } + +div#page-body a.mailto:before { + white-space:nowrap; + content: url(/home/centos/artwork/trunk/Identity/Images/Webenv/a-mail.png); + margin: 0 0.2em; + } + +div#page-body a.attachment:before { + white-space:nowrap; + content: url(/home/centos/artwork/trunk/Identity/Images/Webenv/a-attach.png); + margin: 0 0.2em; + } diff --git a/Scripts/Python/Webenv/Public/Stylesheet/lists.css b/Scripts/Python/Webenv/Public/Stylesheet/lists.css new file mode 100755 index 0000000..703dccd --- /dev/null +++ b/Scripts/Python/Webenv/Public/Stylesheet/lists.css @@ -0,0 +1,111 @@ +/* + * Webenv -> Lists + * + * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG + * + * This CSS 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 CSS 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * ---------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------- + */ + +div#page-body ul { + /* + list-style: url("https://projects.centos.org/webenv-pub/Images/ul.png") disc; + */ + } + +div#page-body ul, +div#page-body ol { + margin-left: 2.5em; + } + +div#page-body ul ol, +div#page-body ol ul, +div#page-body dl ul, +div#page-body dl ol { + margin-left: 1.5em; + } + +div#page-body div#links ul { + padding: 0.5em 0.5em 1em 1em; + margin: 0; + list-style: none; + border-top: 1px #EEE solid; + } + +div#page-body div#links ul.first { + border-top: none; + } + +div#page-body div#links ul li { + padding: 2px; + } + +/* Table of content (toc) +--------------------------------------------------------------------*/ + +div#page-body div.toc { + font-size: small; + text-align:left; + margin-bottom: 2em; + } + +div#page-body div.toc p { + font-weight: bold; + margin: 0.5em 0 0.5em 0; + } + +div#page-body div#content div.toc dl { + margin: 0; + } + +div#page-body div#content div.toc dl dl { + margin-left: 2.5em; + } + +/* Content actions links (e.g., categories and archives). +--------------------------------------------------------------------*/ + +div#page-body div#content-actions dl { + margin-top: 0; + margin-left: 0; + } + +div#page-body div#content-actions dl dt { + font-weight: bold; + border-bottom: 1px solid #EEE; + margin-bottom: 1em; + } + +div#page-body div#content-actions dl dd { + margin-left: 1.5em; + } + +div#page-body div#content-actions dl dl { + margin-left: 1.5em; + margin-top: 0px; + border-top: none; + padding-top: 0; + } + +div#page-body div#content-actions dl dl.year { + margin-bottom: 1em; + } + +div#page-body div#content-actions dl dl.year dd { + margin-left: 0; + } diff --git a/Scripts/Python/Webenv/Public/Stylesheet/reset.css b/Scripts/Python/Webenv/Public/Stylesheet/reset.css new file mode 100755 index 0000000..6573975 --- /dev/null +++ b/Scripts/Python/Webenv/Public/Stylesheet/reset.css @@ -0,0 +1,352 @@ +/* + * Webenv (reset) -- This file resets the browser's default visual + * style and sets The CentOS Web Environment visual style as default + * visual style. This file sets default values to tags like `html', + * `body', as well as those controlling links, tables, paragrphs, + * headings, lists, forms and quotation. + * + * The CentOS Web Environment (Webenv) is specially conceived to + * achieve one unique visual style and easy navegation through all + * different web applications The CentOS Project uses to show its + * existence in the World Wide Web medium. + * + * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG + * + * This CSS 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 CSS 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * ------------------------------------------------------------------- + * $Id$ + * ------------------------------------------------------------------- + */ + + +/* Reset browsers default margins and paddings +-----------------------------------------------*/ + +* { + margin: 0; + padding: 0; + } + +/* Define html +-----------------------------------------------*/ + +html { + background-color: #FFF; + background-image: url("https://projects.centos.org/webenv-pub/Images/html-bg.png"); + } + +/* Define body +-----------------------------------------------*/ + +body { + font-family: "DejaVu Sans", "Liberation Sans", sans-serif; + font-size: 0.85em; + /* margin: 0; /* <- full screen */ + /* margin: 0 1% 0 1%; /* <- with 1% of left and right margin */ + /* margin: 0 2% 0 2%; /* <- with 2% of left and right margin */ + margin: 0 3% 0 3%; /* <- with 3% of left and right margin */ + /* margin: 0 10% 0 10%; /* <- with 10% of left and right margin */ + color: #333; + } + +/* Links +-----------------------------------------------*/ + +a:link { text-decoration: none; color: #0044B3; } +a:hover { text-decoration: underline; color: green; } +a:active { text-decoration: underline; color: green; } +a:visited { text-decoration: none; color: #0044B3; } +a:visited:hover { text-decoration: underline; color: green; } + +.title, +.title a:link, +.title a:active, +.title a:hover, +.title a:visited, +.title a:visited:hover { + /* color: #072B61; */ + color: #000000; + } + +/* Headings +-----------------------------------------------*/ + +h1 { + font-size: 2em; + line-height: 1.3em; + } + +h2 { + font-size: 1.5em; + line-height: 1.5em; + margin-top: 1.5em; + } + +h3 { + font-size: 1.4em; + line-height: 1.4em; + margin-top: 1.4em; + } + +h4 { + font-size: 1.2em; + line-height: 1.2em; + margin-top: 1.2em; + } + +h5 { + font-size: 1.1em; + line-height: 1.1em; + margin-top: 1.1em; + } + +h6 { + font-size: 1em; + line-height: 1em; + margin-top: 1em; + } + +/* Paragraphs +-----------------------------------------------*/ + +p { + margin: 1em 0 1.5em 0; + line-height: 1.5em; + text-align: justify; + } + +/* Images +-----------------------------------------------*/ + +img { + border: none; + } + +/* Quotations +-----------------------------------------------*/ + +blockquote { + background: #fafafa; + border-color: #eeeeee; + border-width: 1px; + border-style: solid; + border-left-width: 4px; + margin-left: 1.5em; + padding: 0.5em; + margin-top: 1em; + margin-bottom: 1.3em; + } + +q:before { + content: " “"; + } + +q:after { + content: "” "; + } + +q q:before { + content: " ‘"; + } + +q q:after { + content: "’ "; + } + +address { + margin-left: 1.5em; + } + +/* Preformatted Texts +-----------------------------------------------*/ + +pre { + font-family: "DejaVu Sans Mono", "Liberation Mono", monospace; + padding: 0.5em 1em 0.5em 1em; + margin: 1em 0 1em 0; + white-space: pre; + border-width: 1px; + border-style: solid; + border-color: #E5E5E5; + border-left-width: 4px; + background: #FFFAE9; + overflow: auto; + } + +/* Phrase Elements +-----------------------------------------------*/ + +tt, +samp, +kbd, +code { + font-family: "DejaVu Sans Mono", "Liberation Mono", monospace; + } + +/* Page Lines +-----------------------------------------------*/ + +hr { + clear: both; + height: 1px ! important; + border: none; + background-color: #DADADA; + } + +/* Lists +-----------------------------------------------*/ + +ul, +ol, +dl { + margin: 1.5em 0 1.5em 2.5em; + } + +ul { + list-style: disc; + } + +ol { + list-style-image: none !important; + } + +ul li, +ol li { + line-height: 1.5em; + } + +ul ul, +ul ol, +ol ul, +ol ol { + margin-top: 0.3em; + margin-bottom: 0.3em; + } + +ul li p, +ol li p { + margin-bottom: 0.3em; + } + +dl dd { + margin-left: 2.5em; + } + +dl ol, +dl ul { + margin-left: 3.5em; + } + +/* Tables +-----------------------------------------------*/ + +table { + border-collapse: collapse; + } + +table caption { + font-style: italic; + text-align: center; + } + +table tr th { + font-weight: bold; + } + +table tr td, +table tr th { + border: 1pt; + border-style: solid; + border-color: #CCC; + padding-top: 0.25em; + padding-right: 0.5em; + padding-bottom: 0.25em; + padding-left: 0.5em; + vertical-align: top; + } + +table tr td p, +table tr td pre { + margin: 0; + padding: 0; + } + +/* Forms +-----------------------------------------------*/ + +form { + display: inline; + } + +input[type="submit"], +input[type="button"] { + padding: 1px; + display: inline; + text-decoration: none; + } + +input[type="text"], +input[type="password"], +textarea { + display: inline; + padding: 2px; + } + +select { + display: inline; + padding: 1px; + } + +form p { + display: inline; + margin-left: 5px; + margin-right: 5px; + } + +/* Select +---------------------------------------- */ + +select option { + padding-left: 3px; + padding-right: 3px; + } + +select optgroup { + font-style: normal; + font-weight: bold; + padding-left: 3px; + } + +select optgroup option { + margin-left: 1em; + } + +input[type="radio"], +input[type="checkbox"] { + vertical-align: middle; + } + +fieldset { + margin: 1em 0 1em 0; + padding: 1em; + padding-bottom: 5px; + border: 1px solid #AAA; + } + +fieldset legend { + font-weight: bold; + color: #AAA; + } diff --git a/Scripts/Python/Webenv/Public/Stylesheet/tabs.css b/Scripts/Python/Webenv/Public/Stylesheet/tabs.css new file mode 100755 index 0000000..83230a6 --- /dev/null +++ b/Scripts/Python/Webenv/Public/Stylesheet/tabs.css @@ -0,0 +1,83 @@ +/* + * Webenv -> Tabs (Style 2: Two Rounded Borders) + * + * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG + * + * This CSS 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 CSS 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * ---------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------- + */ + +div#page-header div.tabs { + margin-left: 10px; + margin-right: 10px; + } + +div#page-header div.tabs a { + color: #FFF; + float: left; + font-weight: bold; + margin-right: 3px; + padding: 0px 8px 0 0px; + text-decoration: none; + } + +div#page-header div.tabs span.current a, +div#page-header div.tabs span.current a:hover, +div#page-header div.tabs span.current a span, +div#page-header div.tabs span.current a:hover span { + color: #204A87; + text-decoration: none; + } + +div#page-header div.tabs a span { + float: left; + padding: 5px 0px 3px 8px; + } + +/* */ + +div#page-header div.tabs a { + background: none; + } + +div#page-header div.tabs a span { + background: none; + } + +div#page-header div.tabs span.current a, +div#page-header div.tabs span.current a:hover { + background: url("https://projects.centos.org/webenv-pub/Images/tabs-bg-1.png") 100% -50px no-repeat; + } + +div#page-header div.tabs span.current a span, +div#page-header div.tabs span.current a:hover span { + background: url("https://projects.centos.org/webenv-pub/Images/tabs-bg-2.png") 0 -50px no-repeat; + } + +div#page-header div.tabs span:hover a { + background: url("https://projects.centos.org/webenv-pub/Images/tabs-bg-1.png") 100% 0 no-repeat; + } + +div#page-header div.tabs span:hover a span { + background: url("https://projects.centos.org/webenv-pub/Images/tabs-bg-2.png") 0 0; + } + +/* Application level navigation bar. +--------------------------------------------------------------------*/ +div#page-header div#appslinks div.tabs span:hover a span { + } diff --git a/Scripts/Python/Webenv/Public/stylesheet.css b/Scripts/Python/Webenv/Public/stylesheet.css new file mode 100755 index 0000000..c4ecbf7 --- /dev/null +++ b/Scripts/Python/Webenv/Public/stylesheet.css @@ -0,0 +1,39 @@ +/* + * Webenv + * + * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG + * + * This CSS 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 CSS 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * ---------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------- + */ + +/* Reset browser's default definitions. +--------------------------------------------------------------------*/ +@import url("https://projects.centos.org/webenv-pub/Stylesheet/reset.css"); + +/* Customize default definitions. +--------------------------------------------------------------------*/ +@import url("https://projects.centos.org/webenv-pub/Stylesheet/base.css"); +@import url("https://projects.centos.org/webenv-pub/Stylesheet/links.css"); +@import url("https://projects.centos.org/webenv-pub/Stylesheet/lists.css"); +@import url("https://projects.centos.org/webenv-pub/Stylesheet/admonition.css"); +@import url("https://projects.centos.org/webenv-pub/Stylesheet/forms.css"); + +/* Miscellaneous definitions. +--------------------------------------------------------------------*/ +@import url("https://projects.centos.org/webenv-pub/Stylesheet/tabs.css"); diff --git a/Scripts/Python/Webenv/webenv.cgi b/Scripts/Python/Webenv/webenv.cgi new file mode 100755 index 0000000..d137638 --- /dev/null +++ b/Scripts/Python/Webenv/webenv.cgi @@ -0,0 +1,58 @@ +#!/usr/bin/python +# +# centos-web.cgi -- This script is an effort to organize The CentOS +# Project information in XHTML format for its publication on the +# Internet. The script is organized in a package named `Apps' which, +# in turn, is subdivided in other packages (e.g., `Home', `Sponsors', +# etc.) to cover each web application the organization demands. +# +# Notice that some of the web applications demanded (e.g., Wiki, +# Lists, Forums, Bugs, etc.) are not included in this script, but +# linked to their own locations. Moreover, in order to provide +# accessability among all different web applications, they need to be +# redesigned to share one unique visual style and one unique top-level +# navigation bar so the current web application can be remarked. +# +# Copyright (C) 2011 Alain Reguera Delgado +# +# 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ------------------------------------------------------------------ +# $Id$ +# ------------------------------------------------------------------ + +import cgi +import cgitb; cgitb.enable() + +def main(): + + qs = cgi.parse() + + if 'app' in qs: + app = qs['app'][0].lower() + else: + app = 'home' + + if app == 'home': + from Apps.Home import page + elif app == 'sponsors': + from Apps.Sponsors import page + else: + from Apps.Unknown import page + + print 'Content-type: text/html' + "\n" + print page.main() + +if __name__ == '__main__': main() diff --git a/Scripts/Python/Webenv/webenv.conf b/Scripts/Python/Webenv/webenv.conf new file mode 100644 index 0000000..83b4ce8 --- /dev/null +++ b/Scripts/Python/Webenv/webenv.conf @@ -0,0 +1,33 @@ +# webenv.conf -- This file provides the configuration required by +# Apache HTTP server in order for `webenv.cgi' script to be able of +# running through it. +# +# The configuration provided by this file assumes that you've +# installed the Apache HTTP server in your workstation and have also +# configured it to public content inside the `public_html' directory +# inside the user's home directory. This configuration is mainly for +# developers whom have downloaded a working copy of `webenv.cgi' tree +# into their worstation in order to on it in a way that it be possible +# to test changes before commit them up to the central repository. +# +# To install this configuration, copy this file to +# `/etc/httpd/conf.d/' and, after that, reload the httpd server deamon +# (e.g., /sbin/service httpd reload). +# +# To test the changes you've made in your working copy directory, +# related to `webenv.cgi' tree, open the address +# `http://localhost/webenv/' in your web browser and explore the +# application looking for them. +# +# ------------------------------------------------------------------ +# $Id$ +# ------------------------------------------------------------------ + +# Define the CGI script location. Be sure to use the script file, not +# the directory where the script file is stored in. This way, the +# security issues are reduced to that CGI script you refered to. +ScriptAliasMatch ^/webenv/(.*)$ "/home/centos/public_html/Webenv/webenv.cgi" + +# Define the CGI public location. This is the location where public +# files (e.g., images and css files) are stored in. +Alias /webenv-pub/ "/home/centos/public_html/Webenv/Public/" diff --git a/Scripts/Webenv/Apps/Home/__init__.py b/Scripts/Webenv/Apps/Home/__init__.py deleted file mode 100755 index e69de29..0000000 --- a/Scripts/Webenv/Apps/Home/__init__.py +++ /dev/null diff --git a/Scripts/Webenv/Apps/Home/page.py b/Scripts/Webenv/Apps/Home/page.py deleted file mode 100755 index 97e12eb..0000000 --- a/Scripts/Webenv/Apps/Home/page.py +++ /dev/null @@ -1,91 +0,0 @@ -"""Support module for page layout inside `Home' web application. - -""" -from Apps import page - -app = page.Layout() - - -def page_navibar(): - """Returns application main pages. - - The application main pages are organized as tabs in the - application navigation bar. There is one tab for each main page - inside the application. - - """ - names = ['Page1', 'Page2', 'Page3'] - attrs = [] - - for i in names: - attrs.append({'href': '/webenv/?p=' + i.lower()}) - - if 'p' in page.qs.keys(): - focus = page.qs['p'][0].lower() - else: - focus = '' - - return app.page_navibar(names, attrs, focus) - - -def page_content(): - """Returns page content. - - The page content is determined from the query string, specifically - from the value of `p' variable. - - """ - if 'p' in page.qs.keys(): - p = page.qs['p'][0].lower() - else: - p = '' - - if p == 'page1': - output = app.tag_p('', [12, 1], 'Page Empty.') - elif p == 'page2': - output = app.tag_p('', [12, 1], 'Page Empty.') - elif p == 'page3': - output = app.tag_p({}, [12, 1], 'Page Empty' ) - elif p == 'entry': - output = app.content_details() - else: - output = app.content_list() - - return output - - -def main(): - """Returns final output.""" - - # Define page name. This value is used as reference to determine - # which application to load and what tab in the navigation bar to - # focus on. - app.name = 'Home' - - # Define page title. This value is dislayed on the browser's title - # bar. Notice that we concatenated the page class default value - # here. - app.title += ' :: Home' - - # Define page header. This is the information displayed - # between the page top and page content. - app.header = app.logo() - app.header += app.google_ad_example() - app.header += app.navibar() - app.header += app.releases() - app.header += app.page_links() - app.header += page_navibar() - - # Define page body. This is the information displayed between the - # page header and page footer. - app.body = page_content() - - # Define page footer. This is the information displayed between - # the page bottom and the page content, the last information - # displayed in the page. - app.footer = app.credits() - - # Define page final layout. - html = app.page() - - return html diff --git a/Scripts/Webenv/Apps/Sponsors/__init__.py b/Scripts/Webenv/Apps/Sponsors/__init__.py deleted file mode 100755 index e69de29..0000000 --- a/Scripts/Webenv/Apps/Sponsors/__init__.py +++ /dev/null diff --git a/Scripts/Webenv/Apps/Sponsors/page.py b/Scripts/Webenv/Apps/Sponsors/page.py deleted file mode 100755 index 1791750..0000000 --- a/Scripts/Webenv/Apps/Sponsors/page.py +++ /dev/null @@ -1,91 +0,0 @@ -"""Support module for page layout inside `Sponsors' web application. - -""" -from Apps import page - -app = page.Layout() - - -def page_navibar(): - """Returns application's main pages. - - The application's main pages are organized as tabs in the - application navigation bar. There is one tab for each main page - inside the application. - - """ - names = ['Hardware', 'Hosting', 'Others'] - attrs = [] - - for i in names: - if 'app' in page.qs.keys(): - attrs.append({'href': '/webenv/?app=' + page.qs['app'][0].lower() + '&p=' + i.lower()}) - else: - attrs.append({'href': '/webenv/?p=' + i.lower()}) - - if 'p' in page.qs.keys(): - focus = page.qs['p'][0].lower() - else: - focus = names[0].lower() - - return app.page_navibar(names, attrs, focus) - - -def page_content(): - """Returns page content. - - The page content to show is determined from the query string, - specifically from the value of `p' variable. - - """ - if 'p' in page.qs.keys(): - p = page.qs['p'][0].lower() - else: - p = 'hardware' - - if p == 'hardware': - output = app.tag_h1({'class': 'title'}, [12, 1], 'Hardware Sponsors' ) - elif p == 'hosting': - output = app.tag_h1({'class': 'title'}, [12, 1], 'Hosting Sponsors' ) - elif p == 'others': - output = app.tag_h1({'class': 'title'}, [12, 1], 'Other Sponsors' ) - else: - output = app.tag_p('', [12, 1], 'Page empty.') - - return output - - -def main(): - """Returns final output.""" - - # Define page name. This value is used as reference to determine - # which application to load and what tab in the navigation bar to - # focus on. - app.name = 'Sponsors' - - # Define page title. This value is dislayed on the browser's title - # bar. Notice that we concatenated the page class default value - # here. - app.title += ' :: Sponsors' - - # Define page header. This is the information displayed - # between the page top and the page content. - app.header = app.logo() - app.header += app.google_ad_example() - app.header += app.navibar() - app.header += app.page_links() - app.header += page_navibar() - - # Define page body. This is the information displayed between the - # page header and page footer. - app.body = page_content() - - # Define page footer. This is the information displayed between - # the page bottom and the page content, the last information - # displayed in the page. - app.footer = app.credits() - - # Define page final layout. - html = app.page() - - return html diff --git a/Scripts/Webenv/Apps/Unknown/__init__.py b/Scripts/Webenv/Apps/Unknown/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/Scripts/Webenv/Apps/Unknown/__init__.py +++ /dev/null diff --git a/Scripts/Webenv/Apps/Unknown/page.py b/Scripts/Webenv/Apps/Unknown/page.py deleted file mode 100755 index f7c564e..0000000 --- a/Scripts/Webenv/Apps/Unknown/page.py +++ /dev/null @@ -1,54 +0,0 @@ -"""The `Unknown' web application. - -The Unknown web application is automatically triggered when the page -requested is not defined as valid in `webenv.cgi' script. The -Unknown web application is basically an admonition message describing -the `page not found' issue and where to find the correct links to -start all over. - -""" -from Apps import page - -app = page.Layout() - - -def page_content(): - """Returns page content.""" - output = app.tag_p('', [16,1], 'The page you tried to open was not found in this server. Try one of the links above to start over.') - output = app.admonition('Warning', 'Page not found.', output) - output = app.tag_div({'id':'content-unknown'}, [8,1], output, 1) - return output - - -def main(): - """Returns final output.""" - - # Define page name. This value is used as reference to determine - # which application to load and what tab in the navigation bar to - # focus on. - app.name = 'Unknown' - - # Define page title. This value is dislayed on the browser's title - # bar. Notice that we concatenated the page class default value - # here. - app.title += ' :: Page not found' - - # Define page header. This is the information displayed - # between the page top and the page content. - app.header = app.logo() - app.header += app.google_ad_example() - app.header += app.navibar() - - # Define page body. This is the information displayed between the - # page header and page footer. - app.body = page_content() - - # Define page footer. This is the information displayed between - # the page bottom and the page content, the last information - # displayed in the page. - app.footer = app.credits() - - # Define page final layout. - html = app.page() - - return html diff --git a/Scripts/Webenv/Apps/__init__.py b/Scripts/Webenv/Apps/__init__.py deleted file mode 100755 index e69de29..0000000 --- a/Scripts/Webenv/Apps/__init__.py +++ /dev/null diff --git a/Scripts/Webenv/Apps/page.py b/Scripts/Webenv/Apps/page.py deleted file mode 100755 index 126be63..0000000 --- a/Scripts/Webenv/Apps/page.py +++ /dev/null @@ -1,970 +0,0 @@ -# Copyright (C) 2011 The CentOS Project -# -# 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, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ------------------------------------------------------------------ -# $Id$ -# ------------------------------------------------------------------ -"""Support page construction. - -The page construction is an XHTML document consisting of several -independent components that, when put together, provide organization -to content. Each of these components is set as a method of Layout -class that can be instantiated later from application specific modules. - -When you create a new application package, you need to create a page -module for it and instantiate the Layout class provided here inside -it. Later, the following functions must be created: page_content(), -page_navibar() and main(). These functions are used to define the -content and navigation bar of your application. Both application -content and application navigation are logically organized using -variables passed through the URL. - -Application -=========== - -URL variable: app - -This variable contains the application id. It is a unique numerical -value that starts at 0 and increments one for each new application -that might be added. The application identified by number 0 is the one -used as default when no other application is provided. The -application identified by number 0 is added to database the first time -it is created as part of the initial configuration process. - -Application is the highest level of organization inside -`webenv.cgi' script. Inside applications, there is content in form -of pages and entries. Content can be grouped by categories. - -Pages -===== - -URL variable: page - -This variable contains the page id. It is a unique numerical value -that starts at 0 and increments in one for each new page added to the -application. In contrast to applications, the page identified by -number 0 is not used as default page when no other page is provided. -This configuration is specific to each application and can be -customized inside each application individually, using string values -instead of numerical values when passing values to page variable. - -Generally, when a page variable isn't passed through the URL, the -application module uses the `content_list()' method from Layout class -to display a list of all available content entries while links to -content pages are displayed in the application navigation bar so users -can access them. The unique numerical value of content pages is -specific to each application, so there is one page 0 for each -application available. No page is added to database the first time the -database is created as part of the initial configuration process. - -Pages contain similar information to that described by contents with -few exceptions. Pages, in contrast to entries, can differentiate the -page title from the page name. The page title goes in the page content -itself and describes what the page is about with a phrase. On the -other hand, the page name is generaly one word describing the page -content and is used as link on the application navigation bar. When -no page name is explicitly provided, the first word of page title is -used instead. - -Pages are always accessible inside the same application while contents -aren't. Pages are permanently visible and linkend from each -application specific navigation bar. This kind of pages can be -managed by editors or administrators and can be marked as `draft' to -put it on a special state where it is possible for administrator, -editors and authors to work on it, but impossible for others to read -it until the page be marked as `published' by either the page author -or any members of editor's or administrator's groups. - -Pages can be converted to entires and the oposite. When convertion -occurs, unused information looses its meaning and is kept for -informative purpose, specially in situations when it might be needed -to realize a convertion back into the former state. Notice that in -order to realize such a back and forth convertion it is required that -both pages and entires share the same definition structure. In fact, -that they be the same thing, but able to differentiate themselves -either as page or entry (e.g., through a `type' field.). - -Pages content is under version control. When a page (or entry) is -changed, a verification is performed to determine whether the -information entered in edition matches the last record in the page -history table. When both the information coming from edition and the -last record in the page history table are the same (e.g., no change -happened) the edition action is cancelled and a message is printed out -to notify the action. Otherwise, when the information entered in -edition differs from the last record in the page history table, the -information comming from edition passes to be the last record in the -page history table. In case, a page be reverted to a revision -different to that one being currently the active page, the reverted -revision becomes the active page (e.g., by changing a `status' field -from `false' to `true' in the history table). - -Categories -========== - -Categories exists to organize contents. When an entry is created it is -automatically linked to a category. Categories are managed by -administrators and editors only. Categories can be nested one another -and provide another way of finding information inside the web -environment. Categories are specific to each web application, just as -contents and pages are. The `Unknown' category is created when the -categories table is created for first time, as part of the initial -configuration process so if no explicit category assignation is set by -the user, a default value (the `Unknown' category in this case) is -used to satisfy the connection between contents and categories. - -Referential integrity -===================== - -Referential integrity is not handle in the logic layer provided by -this module, but set inside the database system used to store the -information handled by this module. The most we do about it here, is -to display a confirmation message before committing such actions, so -you can be aware of them. - -""" - -import cgi -import cgitb; cgitb.enable() -from Apps import xhtml - -qs = cgi.parse() - - -def qs_args( names={}): - """Returns query string arguments. - - The query string arguments are used to build links dynamically - and, this way, to create a browsable and logically organized web - environment. Such a construction generally needs to retrive some - of the values previously passed to the query string and add new - ones to it. - - names: A dictionary containing the variable name and value pair - used to build a new query string. - - When a variable is provied without a value, then its value is - retrived from the current query string. If a value isn't found - there neither, then the variable is removed from the new query - string. - - When a variable is provided with its value, then its value is used - to build the new query string. - - """ - output = '' - - names_keys = names.keys() - names_keys.sort() - for key in names_keys: - if names[key] == '': - if key in qs: - names[key] = qs[key][0] - else: - continue - if output == '': - output = '?' - else: - output += '&' - output += key + '=' + str(names[key]) - - return '/webenv/' + output - - -class Layout(xhtml.Strict): - """The Page Layout. - - The page layout is made by combining XHTML tags in specific ways. - These specific combinations make the page components which in turn - can be also combined. Some of these components can be reused and - others don't. The goal of this class is to define what such - components are and describe them well in order to understand how - to use them from application modules when building XHTML documents - dynamically. - - The page layout is initialized with a functional layout that can - be used as reference inside application modules, to create - variations of it. Generally, inside application packages, this - class is instantiated in a module named `page', variables are - reset and functions created in order to satisfy that application - needs. When you need to output one of the page components then you - use this class instantiated methods. When the method you need - doesn't exist in this class, then it is a good time for it to be - created, here ;). - - Notice that most methods defined in this class make direct use of - methods defined by Strict class inside the `xhtml' module. The - Strict class inside xhtml module is inherited inside this class so - all the methods there are also available here. Methods which - doesn't make a direct use of Strict methods are dependencies of - those which do make direct use of Strict methods. - - """ - - - def __init__(self): - """Initialize page data.""" - self.name = 'Home' - self.title = 'The CentOS Project' - self.description = 'Community Enterprise Operating System' - self.keywords = 'centos, project, community, enterprise, operating system' - self.copyright = '2009-2011 The CentOS Project. All rights reserved.' - self.language = 'en' - - # Define page header. This is the information displayed - # between the page top and the page content. - self.header = self.logo() - self.header += self.google_ad() - self.header += self.navibar() - self.header += self.releases() - self.header += self.page_links() - self.header += self.page_navibar() - - # Define page body. This is the information displayed between - # the page header and page footer. - self.body = 'None' - - # Define page footer. This is the information displayed - # between the page bottom and the page content, the last - # information displayed in the page. - self.footer = self.credits() - - - def logo(self): - """Returns The CentOS Logo. - - The page logo is displayed on the top-left corner of the page. - We use this area to show The CentOS Logo, the main visual - representation of The CentOS Project. In order to print the - page logo correctly, the image related must be 78 pixels of - height. - - """ - attrs = [] - attrs.append({'id': 'logo'}) - attrs.append({'title': 'Community Enterprise Operating System', 'href': '/webenv/'}) - attrs.append({'src': '/webenv-pub/Images/centos-logo.png', 'alt': 'CentOS'}) - - return self.tag_div(attrs[0], [8,1], self.tag_a(attrs[1], [12,1], self.tag_img(attrs[2], [0,0]), 0), 1) - - - def google_ad_example(self): - """Returns Google advertisement for offline testings.""" - title = 'Google Advertisement' - url = '/webenv-pub/Images/ads-sample-468x60.png' - image = self.tag_img({'src': url, 'alt': title}, [0,0]) - link = self.tag_a({'href': url, 'title': title}, [12,1], image) - output = self.tag_div({'class':'google-ad'}, [8,1], link, 1) - output += self.separator({'class':'page-line'}, [8,1]) - - return output - - - def google_ad(self): - """Returns Google advertisement for online using.""" - - properties = {} - properties['google_ad_client'] = 'pub-6973128787810819' - properties['google_ad_width'] = '468' - properties['google_ad_height'] = '60' - properties['google_ad_format'] = '468x60_as' - properties['google_ad_type'] = 'text_image' - properties['google_ad_channel'] = '' - properties['google_color_border'] = '204c8d' - properties['google_color_bg'] = '345c97' - properties['google_color_link'] = '0000FF' - properties['google_color_text'] = 'FFFFFF' - properties['google_color_url'] = '008000' - - attrs = {} - attrs['type'] = "text/javascript" - - output = '\n' - - properties = self.tag_script(attrs, [12,1], output, 1) - - attrs['src'] = "http://pagead2.googlesyndication.com/pagead/show_ads.js" - - source = self.tag_script(attrs, [12,1], ' ', 0) - - output = self.tag_div({'class':'google-ad'}, [8,1], properties + source, 1) - output += self.separator({'class':'page-line'}, [8,1]) - - return output - - - def navibar(self): - """Returns webenv navigation bar. - - The webenv navigation bar organizes links to main web - applications The CentOS Project makes use of. Links to these - web applications stay always visible, no matter what web - application the user be visiting (e.g., Wiki, Lists, Forums, - Projects, Bugs, Docs, Downloads and Sponsors.). Notice that - some of these web applications are out of `webenv.cgi' - scope and they need to code their own webenv navigation bars - in a way that coincide the one set by `webenv.cgi'. - - """ - names = ['Home', 'Wiki', 'Lists', 'Forums', 'Projects', 'Bugs', 'Docs', 'Downloads', 'Sponsors'] - attrs = [] - focus = self.name - - for i in range(len(names)): - if names[i].lower() == 'home': - attrs.append({'href': '/webenv/'}) - else: - attrs.append({'href': '/webenv/?app=' + names[i].lower()}) - - tabs = self.navibar_tabs(names, attrs, focus) - tabs += self.separator() - - return tabs - - - def navibar_tabs(self, names, attrs, focus=''): - """Returns navigation tabs. - - The navigation tabs are the smaller components a navigation - bar like "top-level navigation bar" and "application - navigation bar" are made of. - - names: List containing link names of tabs. - - attrs: List containing a dictionary for each tab link name - inside the `names' list. Dictionaries inside attrs - argument contain the link attributes (e.g., accesskey, - title, and href) used by link names so they can be - linkable once rendered. - - focus: Name of the link marked as current. - - """ - navibar_tabs = '' - - for i in range(len(names)): - output = self.tag_span('', [0,0], str(names[i])) - output = self.tag_a(attrs[i], [16,1], output) - if str(names[i]).lower() == focus.lower(): - output = self.tag_span({'class': 'current'}, [12,1], output, 1) - else: - output = self.tag_span('', [12,1], output, 1) - navibar_tabs += output - - return self.tag_div({'class': 'tabs'}, [8,1], navibar_tabs, 1) - - - def releases(self): - """Returns The CentOS Distribution last releases. - - This method introduces the `releases' method by providing - links to it. - - names: List containing release numbers in the form M.N, where M - means major release and N minor release. - - attrs: List containing a dictionary for each release number - provided in `names' argument. These dictionaries provide - the link attributes required by release numbers in order - for them to be transformed into valid links once the page - be rendered. - - """ - releases = '' - - names = [] - names.append('6.0') - - attrs = [] - attrs.append({'href': qs_args({'p':'releases', 'id': 6.0})}) - - - title = self.tag_a({'href': qs_args({'p':'releases'})}, [0,0], 'Last Releases') + ':' - title = self.tag_span({'class': 'title'}, [16,1], title) - - for i in range(len(names)): - link = self.tag_a(attrs[i], [20,1], names[i]) - if i == len(names) - 1: - span = self.tag_span({'class': 'last release'}, [16,1], link, 1) - else: - span = self.tag_span({'class': 'release'}, [16,1], link, 1) - releases += span - releases = self.tag_div({'class': 'left'}, [12,1], title + releases, 1) - - rsslink = self.tag_span('', [0,0], 'RSS') - rsslink = self.tag_a({'href': qs_args({'rss':'releases'}), 'title': 'RSS'}, [20,1], rsslink) - rsslink = self.tag_span({'class': 'rss'}, [16,1], rsslink, 1) - rsslink = self.tag_div({'class': 'right'}, [12, 1], rsslink, 1) - - return self.tag_div({'id': 'last-releases'}, [8,1], releases + rsslink, 1) - - - def user_links_logs(self): - """Return links related to user's logs. - - This function introduces the `logs' module. The `logs' module - registers all user's activity, from login to logout. This link - must be display/accessible only after a user has successfully - login. - - """ - last_visit = self.tag_a({'href': qs_args({'app':'', 'p':'logs'})}, [0,0], 'Logs') - return self.tag_div({'class': 'logs'}, [12, 1], last_visit, 1) - - - def user_links_session(self): - """Returns links related to user's session. - - This function introduces the `session' module. The `session' - module provides state to user interactions so their action can - be registered individually. - - """ - names = [] - attrs = [] - session = '' - - names.append('Lost your password?') - attrs.append({'href': qs_args({'app':'', 'p':'lostpwd'})}) - names.append('Register') - attrs.append({'href': qs_args({'app':'', 'p':'register'})}) - names.append('Login') - attrs.append({'href': qs_args({'app':'', 'p':'login'})}) - - for i in range(len(names)): - output = self.tag_a(attrs[i], [20,1], str(names[i]), 0) - if i == len(names) - 1: - output = self.tag_span({'class': 'last'}, [16,1], output, 1) - else: - output = self.tag_span('', [16,1], output, 1) - session += output - - return self.tag_div({'class': 'session'}, [12,1], session, 1) - - - def user_links_trails(self, names=['None'], attrs=[{'href': '/webenv/'}]): - """Returns page trails (a.k.a. breadcrumbs). - - The page breadcrumbs record the last pages the user visited - inside the current web application. Notice that page - breadcrumbs are user-specific information, so it isn't - possible to implement them until a way to manage user sessions - be implemeneted inside `webenv.cgi' script. Until then, - keep the tag construction commented and return an empty value. - - names: List with trail link names. - - attrs: Dictionary with trail link attributes. - - """ - links = '' - - for i in range(len(names)): - if i == len(names) - 1: - output = self.tag_span({'class':'last'}, [16,1], self.tag_a(attrs[i], [20, 1], names[i]), 1) - else: - output = self.tag_span('', [16,1], self.tag_a(attrs[i], [20, 1], names[i], 0), 1) - links += output - - return self.tag_div({'class': 'trail'}, [12,1], links, 1) - - - def user_links(self): - """Returns user related links. - - The user links are specific to each web application. They are - shown over the application navigation bar. - - """ - userlinks = self.user_links_logs() - userlinks += self.user_links_session() - userlinks += self.user_links_trails() - - return self.tag_div({'class': 'userlinks'}, [8,1], userlinks, 1) - - - def page_navibar(self, names=['Welcome'], attrs=[{'href':'/webenv/?p=welcome'}], focus='Welcome'): - """Returns navigation bar for application main pages. - - names: List containing link names. - - attrs: List containing one dictionary for each link name in - `names' argument. Dictionaries here contain the link - attributes needed to make linkable tabs once the page is - rendered. - - """ - navibar_app = self.navibar_tabs(names, attrs, focus) - navibar_app += self.separator({'class': 'page-line white'}, [8,1]) - - return navibar_app - - - def separator(self, attrs={'class': 'page-line'}, indent=[16,1]): - """Returns separator. - - The separator construction is mainly used to clear both sides - inside the page, specially when floating elements are around. - - attrs: Dictionary containing hr's div attributes. - - indent: List containing hr's div indentation values. - - """ - line = self.tag_hr({'style': 'display:none;'}, [0,0]) - line = self.tag_div(attrs, indent, line) - - return line - - - def license(self): - """Retruns license link.""" - license = 'Creative Commons Attribution-Share Alike 3.0 Unported License' - license = self.tag_a({'href': 'http://creativecommons.org/licenses/by-sa/3.0/'}, [0,0], license) + '.' - - return license - - - def metadata(self): - """Returns metadata.""" - metadata = self.tag_meta({'http-equiv': 'content-type', 'content': 'text/html; charset=UTF-8'}, [4,1]) - metadata += self.tag_meta({'http-equiv': 'content-style-type', 'content': 'text/css'}, [4,0]) - metadata += self.tag_meta({'http-equiv': 'content-language', 'content': str(self.language)}, [4,1]) - metadata += self.tag_meta({'name': 'keywords', 'content': str(self.keywords)}, [4,0]) - metadata += self.tag_meta({'name': 'description', 'content': str(self.description)}, [4,1]) - metadata += self.tag_meta({'name': 'copyright', 'content': 'Copyright © ' + str(self.copyright)}, [4,0]) - metadata += self.tag_title('', [4,1], self.title) - metadata += self.tag_link({'href': '/webenv-pub/stylesheet.css','rel': 'stylesheet', 'type': 'text/css'}, [4,0]) - metadata += self.tag_link({'href': '/webenv-pub/centos-fav.png', 'rel': 'shortcut icon', 'type': 'image/png'}, [4,1]) - - return self.tag_head('', [0,1], metadata) - - - - - def searchform(self, size=15): - """Returns search form. - - The search form redirects user from the current page onto the - search page, where the keywords previously introduced in the - input field are processed then. - - size: A number discribing how large the search box is. - - """ - input = self.tag_input({'type':'text', 'value':'', 'size':size}, [0,0]) - - action = self.tag_dt({}, [20,1], 'Search') - action += self.tag_dd({}, [20,1], input) - action = self.tag_dl({'class':'search'}, [16,1], action, 1) - - return self.tag_form({'action': qs_args({'app':'', 'p':'search'}), - 'method':'post', 'title':'Search'}, - [12,1], action, 1) - - - def content_resumen(self, attrs, id, title, user_id, commit_date, - update_date, category_id, comments, abstract): - """Returns content resumen. - - The content resumen is used to build the list of contents, - output by `content_list()' method. The content resumen intends - to be concise and informative so the user can grab a general - idea about the related content and what it is about. - - attrs: A dictionary discribing the rows style. This is useful - to alternate the row background colors. - - id: A unique numerical value referring the content - identification. This is the value used on administrative - tasks like updating and deleting. - - title: A few words phrase describing the content, up to 255 - characters. - - author_id: A string referring the user email address, as - specified by RFC2822. The user email address is used as id - inside The CentOS User LDAP server, where user specific - information (e.g., surname, lastname, office, phone, etc.) - are stored in. This is the field that bonds the user with - the content he/she produces. - - commit_date: A string referring the timestamp the content - arrived to database for time. - - update_date: A string representing the timestamp the content - was updated/revised for last time. - - category_id: A number refering the category id the content is - attached to. - - abstract: One paragraphs describing the content. This - information is used to build the page metadata - information. When this value is not provided no abstract - information is displayed in the page, but the is built using article's first 255 - characters. - - comments: A number representing how many comments the content - has received since it is in the database. - - The content itself is not displayed in the resumen, but in - `content_details()'. - - """ - title = self.tag_a({'href': qs_args({'app':'', 'p':'entry', 'id':id})}, [0,0], title) - title = self.tag_h3({'class': 'title'}, [20,1], title, 0) - info = self.content_info(id, user_id, commit_date, - update_date, category_id, comments, - abstract) - return self.tag_div(attrs, [16,1], title + info, 1) - - - def pagination(self): - """Return content pagination.""" - previous = self.tag_a({'href':''}, [0,0], 'Previous') - previous = self.tag_span({'class':'previous'}, [20,1], previous) - next = self.tag_a({'href':''}, [0,0], 'Next') - next = self.tag_span({'class':'next'}, [20,1], next) - separator = self.separator({'class':'page-line'}, [20,1]) - return self.tag_div({'class':'pagination'}, [16,1], previous + - next + separator, 1) - - - def content_info(self, content_id, user_id, commit_date, - update_date, category_id, comments, abstract): - """Return content information. - - The content information provides a reduced view of content so - people can make themselves an idea of what the content talks - about. The content information displays content's title, - author, timestamp, related category, number of comments and an - abstract of the whole content. - - """ - categories = [] - categories.append('Unknown') - categories.append('Erratas') - categories.append('Articles') - categories.append('Events') - - if category_id <= len(categories): - category_name = categories[category_id].capitalize() - else: - category_id = 0 - category_name = categories[category_id].capitalize() - - category_name = self.tag_a({'href': qs_args({'app':'', 'p':'categories', 'id':category_id})}, [0,0], category_name) - category_name = self.tag_span({'class':'category'}, [24,1], category_name) - - users = {} - users['al@centos.org'] = 'Alain Reguera Delgado' - users['ana@centos.org'] = 'Ana Tamara Reguera Gattorno' - users['alina@centos.org'] = 'Alina Reguera Gattorno' - - if user_id in users.keys(): - user_name = self.tag_a({'href':'mailto:' + user_id}, [0,0], users[user_id]) - user_name = self.tag_span({'class':'author'}, [24,1], 'Written by ' + user_name) - - if update_date != commit_date: - date = self.tag_span({'class':'date'}, [24,1], update_date) - else: - date = self.tag_span({'class':'date'}, [24,1], commit_date) - - - comments_attrs = {'href': qs_args({'app':'', 'p':'entry', 'id':content_id}) + '#comments'} - if comments == 1: - comments = self.tag_a(comments_attrs, [0,0], str(comments) + ' comment') - elif comments > 1: - comments = self.tag_a(comments_attrs, [0,0], str(comments) + ' comments') - else: - comments = 'No comments' - comments = self.tag_span({'class':'comment'}, [24,1], comments) - - abstract = self.tag_p({'class':'abstract'}, [24,1], abstract) - - return self.tag_div({'class': 'info'}, [20,1], user_name + date + category_name + comments + abstract, 1) - - - def content_list(self): - """Return list of content. - - The list of content is used to explore the content available - inside specific pages of specific web applications. The - information is displayed through paginated rows of content - that can be filtered to reduce the search results based on - patterns. By default, the list of content displays 15 rows, - but this value can be changed in user's preferences. - - """ - output = '' - count = 0 - rows = [] - rows.append([0, 'Introduction to CentOS Web Environment', - 'al@centos.org', - '2011-8-30 12:33:11', - '2011-8-30 12:33:11', - 0, - 0, - 'This is the abstract paragrah of content. '*10]) - rows.append([1, 'Creating New Applications', - 'al@centos.org', - '2011-8-30 12:33:11', - '2011-8-30 12:33:11', - 2, - 1, - 'This is the abstract paragrah of content. '*5]) - rows.append([2, 'Texinfo Documentation Backend', - 'al@centos.org', - '2011-8-30 12:33:11', - '2011-8-30 12:33:11', - 1, - 5, - 'This is the abstract paragrah of content. '*8]) - - for row in rows: - if count == 0: - attrs = {'class': 'dark row'} - count += 1 - else: - attrs = {'class': 'light row'} - count = 0 - output += self.content_resumen(attrs, *row) - - list = output + self.pagination() + self.separator() - list = self.tag_div({'id':'content-list'}, [12,1], list, 1) - actions = self.searchform() + self.categories() + self.archives() - actions = self.tag_div({'id':'content-actions'}, [8,1], actions, 1) - - return actions + list - - - def content_details(self): - """Return content details. - - The content detail is shown for contents and pages. - """ - output = '' - rows = [] - rows.append([0, 'Introduction to CentOS Web Environment', - 'al@centos.org', - '2011-8-30 12:33:11', - '2011-8-30 12:33:11', - 0, - 0, - 'This is the abstract paragrah of content. '*10, - 'This is the first paragraph of content'*10 + "\n" - 'This is the second paragraph of content'*20 + - "\n" + 'This is the third paragraph of content.'*10 + "\n"]) - rows.append([1, 'Creating New Applications', - 'al@centos.org', - '2011-8-30 12:33:11', - '2011-8-30 12:33:11', - 2, - 1, - 'This is the abstract paragrah of content. '*5, - "This is the first paragraph of content\n\ - This is the second paragraph of content.\n\ - This is the third paragraph of content."]) - rows.append([2, 'Texinfo Documentation Backend', - 'al@centos.org', - '2011-8-30 12:33:11', - '2011-8-30 12:33:11', - 1, - 5, - 'This is the abstract paragrah of content. '*8, - "This is the first paragraph of content.\n\ - This is the second paragraph of content.\n\ - This is the third paragraph of content."]) - - if 'id' in qs: - id = int(qs['id'][0]) - title = rows[id][1] - email = rows[id][2] - commit_date = rows[id][3] - update_date = rows[id][4] - category = rows[id][5] - comments = rows[id][6] - abstract = self.tag_p({}, [0,0], rows[id][7]) - - output = self.tag_h1({'class':'title'}, [12,1], title) - output += self.content_info(id, email, commit_date, update_date, category, comments, abstract) - output += self.tag_p({}, [20,1], rows[id][8]) - output += self.comments() - - return self.tag_div({'id':'content-details'}, [12,1], output, 1) - - - def comments(self): - """Returns content specific list of comments. - - """ - output = self.tag_a({'name':'comments'}, [0,0], 'Comments') - output = self.tag_h2({'class':'title comments'}, [12,1], output, 0) - - return output - - - def categories(self): - """Returns list of categories. - - """ - categories = ['Unknown', 'Articles', 'Erratas', 'Events'] - dt = self.tag_dt({}, [16,1], 'Categories') - dd = '' - for id in range(len(categories)): - category_attrs = {'href': qs_args({'app':'', 'p':'categories', 'id':id})} - a = self.tag_a(category_attrs, [0,0], categories[id] + ' (0)') - dd += self.tag_dd({}, [16,1], a) - - return self.tag_dl({},[12,1], dt + dd, 1) - - - def archives(self): - """Returns archives.""" - archives = {} - archives['2011'] = ['January', 'February', 'March', 'April', 'May'] - archives['2010'] = ['January', 'February'] - - dt = self.tag_dt({}, [16,1], 'Archives') - year_dl = '' - year_dd = '' - - for key in archives.keys(): - year_dt = self.tag_dt({},[20,1], key) - for id in range(len(archives[key])): - a = self.tag_a({'href': qs_args({'app':'', 'p':'archives', 'year': key, 'month': id + 1})}, [0,0], archives[key][id] + ' (0)') - year_dd += self.tag_dd({}, [20,1], a) - year_dl += self.tag_dl({'class':'year'}, [16,1], year_dt + year_dd, 1) - year_dd = '' - - return self.tag_dl({},[12,1], dt + year_dl, 1) - - - def page_top(self): - """Returns page top anchor.""" - return self.tag_a({'name':'top'}, [0,1]) - - - def page_header(self): - """Returns page header. - - The page_header is common to all application modules and - """ - return self.tag_div({'id': 'page-header'}, [4,1], self.header, 1) - - - def page_body(self): - """Returns page body. - - The page_body is specific to each application module and is - there where it must be constructed. The construction itself - takes place through the `page_content()' function which does a - return through an instantiated `content_' prefixed method. - The `content_' prefixed method used depends on the kind of - content you want to print out (e.g., `content_list()' for a - content list, `detail()' for a detailed view of content, - etc.). Later, the `body' variable instantiated from this class - is reset in the `main()' function with the value returned from - `page_content()' so the desired content layout can be printed - out. - - """ - return self.tag_div({'id':'page-body'}, [4,1], self.body, 1) - - - def page_links(self): - """Returns page links.""" - page_links = self.user_links() - return self.tag_div({'id': 'pagelinks'}, [8,1], page_links, 1) - - - def page_footer(self): - """Retruns page footer.""" - return self.tag_div({'id': 'page-footer'}, [4,1], self.credits(), 1) - - - def page_wrap(self): - """Returns page wrap.""" - return self.tag_div({'id': 'wrap'}, [0,1], self.page_header() + self.page_body() + self.page_footer(), 1) - - - def admonition(self, title='Note', subtitle="", body=""): - """Returns page admonition. - - title: Admonition's title. - - subtitle: Admonition's subtitle. The value of this argument is - concatenated on the right side of title using a colon (:) - as separator. Notice that this value is expanded inside - the

    tag and there is no need to introduce extra tags - here. - - body: Admonition's body. The values passed through this - arguments needs to be XHTML code returned from - `self.tag()'. Preferably, paragraphs (p), tables (table), - lists (ul, ol, dl) and pre-formatted texts (pre). - - """ - if title == '': - return '' - else: - title = str(title.capitalize()) - - if subtitle != '': - subtitle = ': ' + str(subtitle.capitalize()) - - if body != '': - body = str(body) - - admonitions = ['Note', 'Tip', 'Important', 'Caution', 'Warning', 'Redirected', 'Success', 'Error'] - - if title in admonitions: - attrs = {'class': 'admonition ' + title.lower()} - image = self.tag_img({'src': '/webenv-pub/Images/' + title.lower() + '.png', 'alt': title}, [16,1]) - title = self.tag_h3({'class': 'title'}, [16,1], title + subtitle, 0) - output = image + title + body + self.separator() - else: - attrs = {'class': 'admonition unknown'} - title = self.tag_h3({'class': 'title'}, [16,1], title + subtitle, 1) - output = title + body - - return self.tag_div(attrs, [12,1], output, 1) - - - def credits(self): - """Returns page credits.""" - copyright = self.tag_p({'class': 'copyright'}, [12,1], 'Copyright © ' + str(self.copyright)) - license = self.tag_p({'class': 'license'}, [12,1], 'This website is licensed under a ' + str(self.license())) - credits = self.tag_img({'src': '/webenv-pub/Images/top.png', 'alt': 'Top'}, [0,0]) - credits = self.tag_a({'title': 'Top', 'href': '#top'}, [16,1], credits) - credits = self.tag_div({'class': 'top'}, [12,1], credits, 1) - credits = str(credits) + str(copyright) + str(license) - credits = self.tag_div({'class': 'credits'}, [8,1], credits, 1) - - return credits - - - def page(self): - """Returns page final output.""" - html = self.doctype() - html += self.tag_html({'xmlns': 'http://www.w3.org/1999/xhtml', 'dir': 'ltr', - 'lang': str(self.language), 'xml:lang': str(self.language)}, [0,1], - self.metadata() + self.page_top() + self.page_wrap()) - - return html diff --git a/Scripts/Webenv/Apps/xhtml.py b/Scripts/Webenv/Apps/xhtml.py deleted file mode 100755 index be646b5..0000000 --- a/Scripts/Webenv/Apps/xhtml.py +++ /dev/null @@ -1,1451 +0,0 @@ -# Copyright (C) 2011 The CentOS Project -# -# 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, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ------------------------------------------------------------------ -# $Id$ -# ------------------------------------------------------------------ -"""Support XHTML construction. - -XHTML construction, as set here, uses the Extensible HTML version 1.0 -DTDs (/usr/share/sgml/xhtml1/xhtml1-20020801/DTD/) as reference. XHTML -construction is required by page module. -""" - - -class Strict: - """Implements XHTML strict document type definition.""" - - - # Core attributes common to most elements. - coreattrs = ['id', # document-wide unique id - 'class', # space separated list of classes - 'style', # associated style info - 'title' # advisory title/amplification - ] - - # Internationalization attributes. - i18n = ['lang', # language code (backwards compatible) - 'xml:lang', # language code (as per XML 1.0 spec) - 'dir' # direction for weak/neutral text - ] - - # Attributes for common UI events. - events = ['onclick', # a pointer button was clicked - 'ondblclick', # a pointer button was double clicked - 'onmousedown', # a pointer button was pressed down - 'onmouseup', # a pointer button was released - 'onmousemove', # a pointer was moved onto the element - 'onmouseout', # a pointer was moved away from the element - 'onkeypress', # a key was pressed and released - 'onkeydown', # a key was pressed down - 'onkeyup' # a key was released - ] - - # Attributes for elements that can get the focus. - focus = ['accesskey', # accessibility key character - 'tabindex', # position in tabbing order - 'onfocus', # the element got the focus - 'onblur' # the element lost the focus - ] - - # Attributes generic format. - attrs = coreattrs + i18n + events - - - def __init__(self): - """Initialize class data.""" - pass - - - def tag(self, name, attrs, indent=[8,1], content="", has_child=0): - """Returns generic XHTML tag definition. - - Arguments: - - name: The XHTML tag's name. Notice that this function doesn't - verify nor validate the XHTML tags you provide. It is up - to you write them correctly considering the XHTML standard - definition. - - attrs: The XHTML tag's attribute. Notice that this function - doesn't verify the attributes assignation to tags. You - need to know what attributes are considered valid to the - tag you are creating in order to build a well-formed XHTML - document. Such verification can be achived inside firefox - browser through the `firebug' plugin. - - indent: The XHTML tag's indentation (Optional). This argument - is a list of two numerical values. The first value in the - list represents the amount of horizontal spaces between - the beginning of line and the opening tag. The second - value in the list represents the amount of vertical spaces - (new lines) between tags. - - content: The XHTML tag's content (Optional). This argument - provides the information the tag encloses. When this - argument is empty, tag is rendered without content. - - has_child: The XHTML tag has a child? (Optional). This - argument is specifies whether a tag has another tag inside - (1) or not (0). When a tag has not a child tag, - indentation is applied between the tag content and the - closing tag provoking an unecessary spaces to be shown. - Such kind of problems are prevented by setting this option - to `0'. On the other hand, when a tag has a child tag - inside, using the value `1' will keep the closing tag - indentation aligned with the opening one. - - This function encapsulates the construction of XHTML tags. - Use this function wherever you need to create XHTML tags. It - helps to standardize tag constructions and their final output - and. This function provides a consistent way of producing - output for XHTML documents. - """ - if indent[0] > 0: - h_indent = ' '*indent[0] - else: - h_indent = '' - - if indent[1] > 0: - v_indent = "\n"*indent[1] - else: - v_indent = '' - - output = v_indent + h_indent + '<' + str(name) - if len(attrs) > 0: - attr_names = attrs.keys() - attr_names.sort() - for attr_name in attr_names: - output += ' ' + str(attr_name) + '="' + str(attrs[attr_name]) + '"' - if content == '': - output += ' />' - else: - output += '>' - output += str(content) - if has_child == 1: - output += h_indent + '' - else: - output += '' - output += v_indent - - return output - - - # ------------------------------------------------------------------ - # Document Type Definition - # ------------------------------------------------------------------ - - def doctype(self): - """Return document type definition.""" - output = '' + "\n" - output += '' + "\n" - - return output - - - # ------------------------------------------------------------------ - # Document Structure - # ------------------------------------------------------------------ - - def tag_html(self, attrs, indent, content, has_child=1): - """Returns document structure definition. - - - - - The namespace URI designates the document profile. - - """ - return self.tag('html', attrs, indent, content, has_child=1) - - - # ------------------------------------------------------------------ - # Document Head - # ------------------------------------------------------------------ - - def tag_head(self, attrs, indent, content, has_child=1): - """Returns document head definition. - - - - - - - Content model is %head.misc; combined with a single title and - an optional base element in any order. - - """ - return self.tag('head', attrs, indent, content, has_child) - - - def tag_title(self, attrs, indent, content, has_child=0): - """Returns title definition. - - - - - The title element is not considered part of the flow of text. - It should be displayed, for example as the page header or - window title. Exactly one title is required per document. - - """ - return self.tag('title', attrs, indent, content, has_child) - - - def tag_base(self, attrs, indent): - """Returns document base URI. - - - - - """ - return self.tag('base', attrs, indent) - - - def tag_meta(self, attrs, indent): - """Returns generic metainformation. - - - - - """ - return self.tag('meta', attrs, indent) - - - def tag_link(self, attrs, indent): - """Returns relationship values. - - - - - Relationship values can be used in principle: - - a) for document specific toolbars/menus when used with the - link element in document head e.g. start, contents, - previous, next, index, end, help. - - b) to link to a separate style sheet (rel="stylesheet"). - - c) to make a link to a script (rel="script"). - - d) by stylesheets to control how collections of html nodes - are rendered into printed documents. - - e) to make a link to a printable version of this document - e.g. a PostScript or PDF version (rel="alternate" - media="print"). - - """ - return self.tag('link', attrs, indent) - - - def tag_style(self, attrs, indent, content, has_child=0): - """Returns style info. - - - - - """ - return self.tag('style', attrs, indent, content, has_child) - - - def tag_script(self, attrs, indent, content="", has_child=0): - """Returns script statement. - - - - - - """ - return self.tag('script', attrs, indent, content, has_child) - - - def tag_noscript(self, attrs, indent, content, has_child=1): - """Returns alternate content container for non script-based - rendering. - - - - - """ - return self.tag(self, attrs, indent, content, has_child) - - - # ------------------------------------------------------------------ - # Document Body - # ------------------------------------------------------------------ - - def tag_body(self, attrs, indent, content, has_child=1): - """Returns document body definition. - - - - - """ - return self.tag('body', attrs, indent, content, has_child) - - - def tag_div(self, attrs, indent, content, has_child=0): - """Returns generic language/style container. - - - - - """ - return self.tag('div', attrs, indent, content, has_child) - - - # ------------------------------------------------------------------ - # Paragraphs - # ------------------------------------------------------------------ - - def tag_p(self, attrs, indent, content, has_child=0): - """Returns paragraph definition. - - - - - When content is introduced inside the database, it goes - without any XHTML markup. This method transforms newline - separated strings into XHTML paragraphs. - - """ - output = '' - for line in content.splitlines(): - if line == '': continue - output += self.tag('p', attrs, indent, line.strip(), has_child) - return output - - - # ------------------------------------------------------------------ - # Headings - # ------------------------------------------------------------------ - # There are six levels of headings from h1 (the most important) to - # h6 (the least important). - # ------------------------------------------------------------------ - - def tag_h1(self, attrs, indent, content, has_child=0): - """Returns h1 definition. - - - - - """ - return self.tag('h1', attrs, indent, content, has_child) - - - def tag_h2(self, attrs, indent, content, has_child=0): - """Returns h2 definition. - - - - - """ - return self.tag('h2', attrs, indent, content, has_child) - - - def tag_h3(self, attrs, indent, content, has_child): - """Returns h3 definition. - - - - - """ - return self.tag('h3', attrs, indent, content, has_child) - - - def tag_h4(self, attrs, indent, content, has_child): - """Returns h4 definition. - - - - - """ - return self.tag('h4', attrs, indent, content, has_child) - - - def tag_h5(self, attrs, indent, content, has_child=0): - """Returns h5 definition. - - - - - """ - return self.tag('h5', attrs, indent, content, has_child) - - - def tag_h6(self, attrs, indent, content, has_child=0): - """Returns h6 definition. - - - - - """ - return self.tag('h6', attrs, indent, content, has_child) - - - # ------------------------------------------------------------------ - # Lists - # ------------------------------------------------------------------ - - def tag_ul(self, attrs, indent, content, has_child=1): - """Returns unordered list definition. - - - - - """ - return self.tag('ul', attrs, indent, content, has_child) - - - def tag_ol(self, attrs, indent, content, has_child=1): - """Returns ordered (numbered) list definition. - - - - - """ - return self.tag('ol', attrs, indent, content, has_child) - - - def tag_li(self, attrs, indent, content, has_child=0): - """Returns item definition for both ordered (ol) and unordered - (ul) lists. - - - - - """ - return self.tag('li', attrs, indent, content, has_child) - - - def tag_dl(self, attrs, indent, content, has_child=1): - """Returns definition list definition. - - - - - """ - return self.tag('dl', attrs, indent, content, has_child) - - - def tag_dt(self, attrs, indent, content, has_child=0): - """Returns term of definition lists. - - - - - """ - return self.tag('dt', attrs, indent, content, has_child) - - - def tag_dd(self, attrs, indent, content, has_child=0): - """Returns definition of definition lists. - - - - - """ - return self.tag('dd', attrs, indent, content, has_child) - - - # ------------------------------------------------------------------ - # Address - # ------------------------------------------------------------------ - - def tag_address(self, attrs, indent, content='', has_child=0): - """Returns information on author. - - - - - """ - return self.tag('address', attrs, indent, content) - - - # ------------------------------------------------------------------ - # Horizontal Rule - # ------------------------------------------------------------------ - - def tag_hr(self, attrs, indent): - """Returns horizontal rule. - - - - - """ - return self.tag('hr', attrs, indent) - - - # ------------------------------------------------------------------ - # Preformatted text - # ------------------------------------------------------------------ - - def tag_pre(self, attrs, indent, content): - """Returns preformatted text. - - - - - content is %Inline; excluding "img|object|big|small|sub|sup" - - """ - return self.tag('pre', attrs, indent, content) - - - # ------------------------------------------------------------------ - # Block-line Quotes - # ------------------------------------------------------------------ - - def tag_blockquote(self, attrs, indent, content): - """Returns block-line quote. - - - - - """ - return self.tag('blockquote', attrs, indent, content) - - - # ------------------------------------------------------------------ - # Inserted/Deleted Text - # ------------------------------------------------------------------ - - def tag_ins(self, attrs, indent, content): - """Returns inserted text. - - - - - Inserted texts are allowed in block and inline content, but - its inappropriate to include block content within an ins - element occurring in inline content. - - """ - return self.tag('ins', attrs, indent, content) - - - def tag_del(self, attrs, indent, content): - """Returns deleted text. - - - - - Deleted texts are allowed in block and inline content, but its - inappropriate to include block content within an ins element - occurring in inline content. - - """ - return self.tag('ins', attrs, indent, content) - - - # ------------------------------------------------------------------ - # The Anchor Element - # ------------------------------------------------------------------ - - def tag_a(self, attrs, indent, content='', has_child=0): - """Returns the anchor element. - - - - - content is %Inline; except that anchors shouldn't be nested. - """ - return self.tag('a', attrs, indent, content, has_child) - - - # ------------------------------------------------------------------ - # Inline Elements - # ------------------------------------------------------------------ - - def tag_span(self, attrs, indent, content, has_child=0): - """Returns span definition. - - - - - """ - return self.tag('span', attrs, indent, content, has_child) - - - def tag_dbo(self, attrs, indent, content, has_child=0): - """Returns dbo definition. - - - - - """ - return self.tag('dbo', attrs, indent, content, has_child) - - - def tag_br(self, attrs, indent): - """Returns break definition. - - - - - """ - return self.tag('br', attrs, indent) - - - def tag_em(self, attrs, indent, content, has_child=0): - """Returns emphasis definition. - - - - - """ - return self.tag('em', attrs, indent, content, has_child) - - - def tag_strong(self, attrs, indent, content, has_child=0): - """Returns strong emphasis definition. - - - - - """ - return self.tag('strong', attrs, indent, content, has_child) - - - def tag_dfn(self, attrs, indent, content, has_child=0): - """Returns definitional definition. - - - - - """ - return self.tag('dfn', attrs, indent, content, has_child) - - - def tag_code(self, attrs, indent, content, has_child=0): - """Returns program code definition. - - - - - """ - return self.tag('code', attrs, indent, content, has_child) - - - def tag_samp(self, attrs, indent, content, has_child=0): - """Returns sample definition. - - - - - """ - return self.tag('samp', attrs, indent, content, has_child) - - - def tag_kbd(self, attrs, indent, content, has_child=0): - """Returns definition for something user would type. - - - - - """ - return self.tag('kbd', attrs, indent, content, has_child) - - - def tag_var(self, attrs, indent, content, has_child=0): - """Returns variable definition. - - - - - """ - return self.tag('var', attrs, indent, content, has_child) - - - def tag_cite(self, attrs, indent, content, has_child=0): - """Returns citation definition. - - - - - """ - return self.tag('cite', attrs, indent, content, has_child) - - - def tag_abbr(self, attrs, indent, content, has_child=0): - """Returns abbreviation definition. - - - - - """ - return self.tag('abbr', attrs, indent, content, has_child) - - - def tag_acronym(self, attrs, indent, content, has_child=0): - """Returns the acronym definition. - - - - - """ - return self.tag('acronym', attrs, indent, content, has_child) - - - def tag_q(self, attrs, indent, content, has_child=0): - """Returns inline quote definition. - - - - - """ - return self.tag('q', attrs, indent, content, has_child) - - - def tag_sub(self, attrs, indent, content, has_child=0): - """Returns subscript definition. - - - - - """ - return self.tag('sub', attrs, indent, content, has_child) - - - def tag_sup(self, attrs, indent, content, has_child=0): - """Returns superscript definition. - - - - - """ - return self.tag('sup', attrs, indent, content, has_child) - - - def tag_tt(self, attrs, indent, content, has_child=0): - """Returns fixed pitch font definition. - - - - - """ - return self.tag('tt', attrs, indent, content, has_child) - - - def tag_i(self, attrs, indent, content, has_child=0): - """Returns italic font definition. - - - - - """ - return self.tag('i', attrs, indent, content, has_child) - - - def tag_b(self, attrs, indent, content, has_child=0): - """Returns bold font definition. - - - - - """ - return self.tag('b', attrs, indent, content, has_child) - - - def tag_big(self, attrs, indent, content, has_child=0): - """Returns bigger font definition. - - - - - """ - return self.tag('big', attrs, indent, content, has_child) - - - def tag_small(self, attrs, indent, content, has_child=0): - """Returns smaller font definition. - - - - - """ - return self.tag('small', attrs, indent, content, has_child) - - - # ------------------------------------------------------------------ - # Object - # ------------------------------------------------------------------ - - def tag_object(self, attrs, indent, content, has_child=1): - """Returns object definition. - - - - - The object definition is used to embed objects as part of HTML - pages. param elements should precede other content. - Parameters can also be expressed as attribute/value pairs on - the object element itself when brevity is desired. - - """ - return self.tag('object', attrs, indent, content, has_child) - - - def tag_param(self, attrs, indent): - """Returns param definition. - - - - - The param definition is used to supply a named property value. - In XML it would seem natural to follow RDF and support an - abbreviated syntax where the param elements are replaced by - attribute value pairs on the object start tag. - - """ - return self.tag('object', attrs, indent) - - - # ------------------------------------------------------------------ - # Images - # ------------------------------------------------------------------ - - def tag_img(self, attrs, indent): - """Returns image definition. - - - - - To avoid accessibility problems for people who aren't able to - see the image, you should provide a text description using the - alt and longdesc attributes. In addition, avoid the use of - server-side image maps. Note that in this DTD there is no - name attribute. That is only available in the transitional - and frameset DTD. - - usemap points to a map element which may be in this document - or an external document, although the latter is not widely - supported. - - """ - return self.tag('img', attrs, indent) - - - # ------------------------------------------------------------------ - # Client-side image maps - # ------------------------------------------------------------------ - - def tag_map(self, attrs, indent, content, has_child=1): - """Returns map definition. - - - - - This can be placed in the same document or grouped in a - separate document although this isn't yet widely supported. - - """ - return self.tag('map', attrs, indent, indent, content, has_child) - - - def tag_area(self, attrs, indent): - """Returns area definition. - - - - - This can be placed in the same document or grouped in a - separate document although this isn't yet widely supported. - - """ - return self.tag('area', attrs, indent) - - - # ------------------------------------------------------------------ - # Forms - # ------------------------------------------------------------------ - - def tag_form(self, attrs, indent, content, has_child=1): - """Returns form definition. - - - - - """ - return self.tag('form', attrs, indent, content, has_child) - - - def tag_label(self, attrs, indent, content, has_child=0): - """Returns label definition. - - - - - Each label must not contain more than ONE field Label elements - shouldn't be nested. - - """ - return self.tag('label', attrs, indent, content, has_child) - - - def tag_input(self, attrs, indent): - """Returns input definition for form control. - - - - - - - The name attribute is required for all but submit & reset. - - """ - return self.tag('input', attrs, indent) - - - def tag_select(self, attrs, indent, content, has_child=0): - """Returns select definition. - - - - - """ - return self.tag('select', attrs, indent, content, has_child) - - - def tag_optgroup(self, attrs, indent, content, has_child=1): - """Returns option group definition. - - - - - """ - return self.tag('optgroup', attrs, indent, content, has_child) - - - def tag_option(self, attrs, indent, content, has_child=0): - """Returns option definition. - - - - - """ - return self.tag('option', attrs, indent, content, has_child) - - - def tag_textarea(self, attrs, indent, content): - """Returns textarea definition. - - - - - """ - return self.textarea('textarea', attrs, indent, content) - - - def tag_fieldset(self, attrs, indent, content, has_child=1): - """Returns fieldset definition. - - - - - The fieldset element is used to group form fields. Only one - legend element should occur in the content and if present - should only be preceded by whitespace. - - """ - return self.tag('filedset', attrs, indent, content, has_child) - - - def tag_legend(self, attrs, indent, content): - """Retruns legend definition. - - - - - """ - return self.tag('legend', attrs, indent, content) - - - def tag_button(self, attrs, indent, content): - """Returns button definition. - - - - - content is %Flow; excluding a, form and form controls. - - """ - return self.tag('button', attrs, indent, content) - - - def tag_table(self, attrs, indent, content, has_child=1): - """Returns table definition. - - - - - - - - - - - Derived from IETF HTML table standard, see [RFC1942] - - The border attribute sets the thickness of the frame around - the table. The default units are screen pixels. The frame - attribute specifies which parts of the frame around the table - should be rendered. The values are not the same as CALS to - avoid a name clash with the valign attribute. The rules - attribute defines which rules to draw between cells: If rules - is absent then assume: "none" if border is absent or - border="0" otherwise "all". Horizontal alignment attributes - for cell contents: - char alignment char, e.g. char=':' - charoff offset for alignment char - - """ - return self.tag('table', attrs, indent, content, has_child) - - - def tag_caption(self, attrs, indent, content): - """Returns caption definition. - - - - - """ - return self.tag('caption', attrs, indent, content) - - - def tag_thead(self, attrs, indent, content, has_child=1): - """Returns thead definition. - - - - - Use thead to duplicate headers when breaking table across page - boundaries, or for static headers when tbody sections are - rendered in scrolling panel. - - """ - return self.tag('thead', attrs, indent, content, has_child) - - - def tag_tbody(self, attrs, indent, content, has_child=1): - """Returns tbody definition. - - - - - Use tbody to duplicate footers when breaking table across page - boundaries, or for static footers when tbody sections are - rendered in scrolling panel. - - """ - return self.tag('tbody', attrs, indent, content, has_child) - - - def tag_tbody(self, attrs, indent, content, has_child=1): - """Returns tbody definition. - - - - - Use multiple tbody sections when rules are needed between - groups of table rows. - - """ - return self.tag('tbody', attrs, indent, content, has_child) - - - def tag_colgroup(self, attrs, indent, content, has_child=1): - """Returns colgroup definition. - - - - - colgroup groups a set of col elements. It allows you to group - several semantically related columns together. - - """ - return self.tag('colgroup', attrs, indent, content, has_child) - - - def tag_col(self, attrs, indent): - """Returns col definition. - - - - - col elements define the alignment properties for cells in one - or more columns. The width attribute specifies the width of - the columns, e.g. - - width=64 width in screen pixels - width=0.5* relative width of 0.5 - - The span attribute causes the attributes of one col element to - apply to more than one column. - - """ - return self.tag('col', attrs, indent) - - - def tag_tr(self, attrs, indent, content, has_child=1): - """Returns table row definition. - - - - - """ - return self.tag('tr', attrs, indent, content, has_child) - - - def tag_th(self, attrs, indent, content, has_child): - """Returns table header definition. - - - - - - - Scope is simpler than headers attribute for common tables. th - is for headers, td for data and for cells acting as both. - - """ - return self.tab('th', attrs, indent, content, has_child) - - - def tag_td(self, attrs, indent, content, has_child=1): - """Returns table data definition. - - - - - """ - return self.tag('td', attrs, indent, content, has_child) diff --git a/Scripts/Webenv/Public/Images/a-attach.png b/Scripts/Webenv/Public/Images/a-attach.png deleted file mode 100644 index d6a41e7..0000000 Binary files a/Scripts/Webenv/Public/Images/a-attach.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/a-mail.png b/Scripts/Webenv/Public/Images/a-mail.png deleted file mode 100644 index 355a998..0000000 Binary files a/Scripts/Webenv/Public/Images/a-mail.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/a-www.png b/Scripts/Webenv/Public/Images/a-www.png deleted file mode 100644 index e5a0483..0000000 Binary files a/Scripts/Webenv/Public/Images/a-www.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/ads-sample-468x60.png b/Scripts/Webenv/Public/Images/ads-sample-468x60.png deleted file mode 100644 index f634d10..0000000 Binary files a/Scripts/Webenv/Public/Images/ads-sample-468x60.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/ads-sample-728x90.png b/Scripts/Webenv/Public/Images/ads-sample-728x90.png deleted file mode 100644 index 5401e60..0000000 Binary files a/Scripts/Webenv/Public/Images/ads-sample-728x90.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/caution.png b/Scripts/Webenv/Public/Images/caution.png deleted file mode 100644 index efcec04..0000000 Binary files a/Scripts/Webenv/Public/Images/caution.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/centos-logo.png b/Scripts/Webenv/Public/Images/centos-logo.png deleted file mode 100644 index 506c65d..0000000 Binary files a/Scripts/Webenv/Public/Images/centos-logo.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/convenction.png b/Scripts/Webenv/Public/Images/convenction.png deleted file mode 100644 index e516c0e..0000000 Binary files a/Scripts/Webenv/Public/Images/convenction.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/error.png b/Scripts/Webenv/Public/Images/error.png deleted file mode 100644 index 0f52b4d..0000000 Binary files a/Scripts/Webenv/Public/Images/error.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/h1-bg.png b/Scripts/Webenv/Public/Images/h1-bg.png deleted file mode 100644 index e609c59..0000000 Binary files a/Scripts/Webenv/Public/Images/h1-bg.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/h2-bg.png b/Scripts/Webenv/Public/Images/h2-bg.png deleted file mode 100644 index 826fbec..0000000 Binary files a/Scripts/Webenv/Public/Images/h2-bg.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/html-bg.png b/Scripts/Webenv/Public/Images/html-bg.png deleted file mode 100644 index 0c6dca6..0000000 Binary files a/Scripts/Webenv/Public/Images/html-bg.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/important.png b/Scripts/Webenv/Public/Images/important.png deleted file mode 100644 index 509ec86..0000000 Binary files a/Scripts/Webenv/Public/Images/important.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/msg-bg-blue.png b/Scripts/Webenv/Public/Images/msg-bg-blue.png deleted file mode 100644 index 47bc405..0000000 Binary files a/Scripts/Webenv/Public/Images/msg-bg-blue.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/msg-bg-gray.png b/Scripts/Webenv/Public/Images/msg-bg-gray.png deleted file mode 100644 index a8a9246..0000000 Binary files a/Scripts/Webenv/Public/Images/msg-bg-gray.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/msg-bg-green.png b/Scripts/Webenv/Public/Images/msg-bg-green.png deleted file mode 100644 index f1bfe2b..0000000 Binary files a/Scripts/Webenv/Public/Images/msg-bg-green.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/msg-bg-orange.png b/Scripts/Webenv/Public/Images/msg-bg-orange.png deleted file mode 100644 index 0866bb8..0000000 Binary files a/Scripts/Webenv/Public/Images/msg-bg-orange.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/msg-bg-red.png b/Scripts/Webenv/Public/Images/msg-bg-red.png deleted file mode 100644 index 2dc3e70..0000000 Binary files a/Scripts/Webenv/Public/Images/msg-bg-red.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/msg-bg-violet.png b/Scripts/Webenv/Public/Images/msg-bg-violet.png deleted file mode 100644 index 8b1075d..0000000 Binary files a/Scripts/Webenv/Public/Images/msg-bg-violet.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/note.png b/Scripts/Webenv/Public/Images/note.png deleted file mode 100644 index b58a224..0000000 Binary files a/Scripts/Webenv/Public/Images/note.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/redirect.png b/Scripts/Webenv/Public/Images/redirect.png deleted file mode 100644 index 16a8c41..0000000 Binary files a/Scripts/Webenv/Public/Images/redirect.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/success.png b/Scripts/Webenv/Public/Images/success.png deleted file mode 100644 index 74cc874..0000000 Binary files a/Scripts/Webenv/Public/Images/success.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/tabs-bg-1.png b/Scripts/Webenv/Public/Images/tabs-bg-1.png deleted file mode 100644 index 22cff37..0000000 Binary files a/Scripts/Webenv/Public/Images/tabs-bg-1.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/tabs-bg-2.png b/Scripts/Webenv/Public/Images/tabs-bg-2.png deleted file mode 100644 index 5d8e178..0000000 Binary files a/Scripts/Webenv/Public/Images/tabs-bg-2.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/tip.png b/Scripts/Webenv/Public/Images/tip.png deleted file mode 100644 index cfcf6db..0000000 Binary files a/Scripts/Webenv/Public/Images/tip.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/top.png b/Scripts/Webenv/Public/Images/top.png deleted file mode 100644 index 1557422..0000000 Binary files a/Scripts/Webenv/Public/Images/top.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/ul.png b/Scripts/Webenv/Public/Images/ul.png deleted file mode 100644 index efcf485..0000000 Binary files a/Scripts/Webenv/Public/Images/ul.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Images/warning.png b/Scripts/Webenv/Public/Images/warning.png deleted file mode 100644 index e36c02a..0000000 Binary files a/Scripts/Webenv/Public/Images/warning.png and /dev/null differ diff --git a/Scripts/Webenv/Public/Stylesheet/admonition.css b/Scripts/Webenv/Public/Stylesheet/admonition.css deleted file mode 100755 index be73065..0000000 --- a/Scripts/Webenv/Public/Stylesheet/admonition.css +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Webenv -> Quotation - * - * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG - * - * This CSS 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 CSS 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, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * ---------------------------------------------------------------------- - * $Id$ - * ---------------------------------------------------------------------- - */ - -div#page-body div.admonition { - border: 1px solid; - border-left: 5px solid; - padding: 10px 20px 10px 10px; - margin: 1.5em 0 1.5em 0; - } - -div#page-body div.admonition pre { - border: none; - background-color: #333; - color: #FFFFFF; - } - -div#page-body div.admonition img { - float: left; - } - - -div#page-body div.admonition h3 { - margin-top: 10px; - line-height: 1.5em; - } - -div#page-body div.admonition h3, -div#page-body div.admonition p, -div#page-body div.admonition pre, -div#page-body div.admonition table { - margin-left: 60px; - } - -div#page-body div.admonition ul, -div#page-body div.admonition ol, -div#page-body div.admonition dl { - margin-left: 110px; - } - -div#page-body div.admonition ul dl, -div#page-body div.admonition ul ol, -div#page-body div.admonition ul ul, -div#page-body div.admonition ol dl, -div#page-body div.admonition ol ol, -div#page-body div.admonition ol ul, -div#page-body div.admonition dl dl, -div#page-body div.admonition dl ol, -div#page-body div.admonition dl ul { - margin-left: 2.5em; - } - -div#page-body div.admonition.unknown pre, -div#page-body div.admonition.unknown h3, -div#page-body div.admonition.unknown p, -div#page-body div.admonition.unknown table { - margin-left: 20px; - } - -div#page-body div.admonition.success, -div#page-body div.admonition.redirected, -div#page-body div.admonition.error { - border: none; - border-top: 5px solid; - border-bottom: 5px solid; - border-color: #CFCFCF; - } - -div#page-body div.admonition.unknown, -div#page-body div.admonition.redirected, -div#page-body div.admonition.note { - background-image: url("https://projects.centos.org/webenv-pub/Images/msg-bg-blue.png"); - border-color: #D2E0F6; - background-color: #ECF4FF; - } - -div#page-body div.admonition.tip, -div#page-body div.admonition.important, -div#page-body div.admonition.caution, -div#page-body div.admonition.warning { - border-color: #F6E7D2; - background-color: #FFF8EC; - background-image: url("https://projects.centos.org/webenv-pub/Images/msg-bg-orange.png"); - } - -div#page-body div.admonition.violet { - border-color: #F6D2F6; - background-color: #FFECFF; - background-image: url("https://projects.centos.org/webenv-pub/Images/msg-bg-violet.png"); - } - -div#page-body div.admonition.error { - border-color: #E0B7B7; - background-color: #FFECEC; - background-image: url("https://projects.centos.org/webenv-pub/Images/msg-bg-red.png"); - } - -div#page-body div.admonition.success { - border-color: #D6F6D2; - background-color: #EEFFEC; - background-image: url("https://projects.centos.org/webenv-pub/Images/msg-bg-green.png"); - } diff --git a/Scripts/Webenv/Public/Stylesheet/base.css b/Scripts/Webenv/Public/Stylesheet/base.css deleted file mode 100755 index 998909e..0000000 --- a/Scripts/Webenv/Public/Stylesheet/base.css +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Webenv -> Main Blocks - * - * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG - * - * This CSS 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 CSS 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, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * ---------------------------------------------------------------------- - * $Id$ - * ---------------------------------------------------------------------- - */ - -div#page-header, -div#wrap, -div#page-body, -div#page-footer { - min-width: 728px; - } - -/* Header ---------------------------------------------------------------------*/ -div#page-header { - background: #204C8D url("https://projects.centos.org/webenv-pub/Images/h1-bg.png") 0 0 repeat; - min-height: 46px; - } - -/* Content ---------------------------------------------------------------------*/ - -div#wrap { - padding: 0 10px 0 10px; - background-color: #FFF; - } - -div#page-body { - clear: both; - background-color: #F8F8F8; - } - -div#page-body div#content-list { - padding: 10px; - padding-left: 0; - padding-top: 8px; - background-color: #FFF; - } - -/* Paragraphs ---------------------------------------------------------------------*/ - -/* Footer ---------------------------------------------------------------------*/ - -div#page-footer { - background: #204C8D url("https://projects.centos.org/webenv-pub/Images/h1-bg.png") 0 0 repeat; - } - -div#page-footer div.credits { - padding: 8px; - } - -div#page-footer div.credits .copyright, -div#page-footer div.credits .license { - font-size: x-small; - color: #FFF; - margin: 3px; - } - -div#page-footer div.credits a { - color: #FFF; - font-style: italic; - } - -div#page-footer div.top { - float:right; - } - -/* Logo ---------------------------------------------------------------------*/ - -div#page-header div#logo img { - border: none; - float: left; - margin-left: 10px; - } - -/* Google advertisement (468x60px) ---------------------------------------------------------------------*/ - -div#page-header div.google-ad { - float: right; - margin: 5px; - } - -div#page-header div.google-ad img { - border: none; - } - -/* Last releases and related RSS link. ---------------------------------------------------------------------*/ - -div#page-header div#last-releases { - clear: both; - min-height: 35px; - border-top: 3px solid #FFF; - background: #3465A4; - } - -div#page-header div#last-releases a { - color: #fff; - } - -div#page-header div#last-releases div.left { - display: block; - float: left; - width: 450px; - margin-top: 10px; - margin-left: 10px; - font-size: small; - } - -div#page-header div#last-releases div.right { - float: right; - margin-top: 9px; - margin-right: 5px; - } - -div#page-header div#last-releases div.right span.rss span { - text-align: center; - font-weight: bold; - background: #729fcf; - padding: 4px 10px; - } - -div#page-header div#last-releases div span.title { - font-weight: bold; - color: #FFF; - } - -div#page-header div#last-releases div span.release { - border-right: 1px dotted #FFF; - padding-left: 10px; - padding-right: 10px; - font-weight: bold; - } - -div#page-header div#last-releases div span.last { - border-right: 0px; - } - -/* Application links ---------------------------------------------------------------------*/ - -div#page-header div#pagelinks { - border-top: 3px solid #FFF; - } - -/* User related links (e.g., last visit, session info and page trails) ---------------------------------------------------------------------*/ - -div#page-header div.userlinks { - padding: 10px; - text-align: right; - font-size: x-small; - clear: both; - } - -div#page-header div.userlinks a { - color: #fff; - } - -div#page-header div.userlinks div.logs { - width: 50%; - float: left; - text-align: left; - } - -div#page-header div.userlinks div.logs span { - border: none; - } - -div#page-header div.userlinks div.logs span.title { - color: #FFF; - } - -div#page-header div.userlinks div.logs span.datetime { - font-style: italic; - color: #FFF; - } - -div#page-header div.userlinks div.session { - width: 50%; - float: right; - } - -div#page-header div.userlinks div.session span { - border-right: 1px dotted #FFF; - } - -div#page-header div.userlinks div.session span a { - margin-right: 10px; - margin-left: 10px; - } - - -div#page-header div.userlinks div.session span.last { - border-right: none; - } - -div#page-header div.userlinks div.session span.last a { - margin-right: 0; - } - -div#page-header div.userlinks div.session span.last:after { - content: none; - } - -div#page-header div.userlinks div.trail { - text-align: right; - clear: both; - padding-top: 5px; - } - -div#page-header div.userlinks div.trail span { - display: inline; - } - -div#page-header div.userlinks div.trail span.last { - border-right: none; - padding-right: 0; - } - -div#page-header div.userlinks div.trail span:after { - content: "»"; - color: #FFF; - margin-left: 5px; - margin-right: 3px; - } - -div#page-header div.userlinks div.trail span.last:after { - content: none; - } - -/* Page lines. ---------------------------------------------------------------------*/ - -.page-line { - clear: both; - margin: 0; - padding: 0; - background-color: transparent; - } - -.page-line.white { - height: 3px; - background-color: #FFF; - } - -/* Page body ---------------------------------------------------------------------*/ - -div#page-body .info { - margin-top: 5px; - } - -div#page-body .info span { - font-size: small; - border-right: 1px dotted #AAA; - padding-right: 10px; - padding-left: 7px; - } - -div#page-body .info span.author { - padding-left: 0; - } - -div#page-body .info span.comment { - border-right: 0; - } - -/* Content Listing - One column ---------------------------------------------------------------------*/ - -div#page-body div#content-list { - margin-right: 200px; - border-right: 3px #EEE solid; - } - -div#page-body div#content-actions { - float:right; - width: 180px; - border-left: 3px #EEE solid; - padding: 10px; - font-size: small; - } - -div#page-body div#content-actions form input[type="text"] { - border: 1px solid #AAA; - } - -div#page-body div#content-list div.search { - } - -div#page-body div#content-list div.row { - padding: 10px 20px; - } - -div#page-body div#content-list div.dark { - background: #F8F8F8; - } - -div#page-body div#content-list div.light { - background: #FFF; - } - -div#page-body div#content-list h3.title { - margin-top: 0; - } - -div#page-body div#content-list .abstract { - margin-bottom: 1em; - } - -div#page-body div#content-list .pagination { - border-top: 1px solid #AAA; - font-size: small; - padding: 10px; - border-top: 1px #AAA solid; - margin-bottom: 0; - padding-bottom: 0; - } - -div#page-body div#content-list .pagination span.previous { - float: left; - } - -div#page-body div#content-list .pagination span.previous a:before { - content: "«"; - padding-right: 3px; - } - -div#page-body div#content-list .pagination span.next a:after { - content: "»"; - padding-left: 3px; - } - -div#page-body div#content-list .pagination span.next { - float: right; - } - -/* Content Details - One column ---------------------------------------------------------------------*/ - -div#page-body div#content-details { - padding: 30px 10% 30px 10%; - background: #FFF; - } - -/* Content Unkown - Not page found. ---------------------------------------------------------------------*/ - -div#page-body div#content-unknown { - padding: 0 15% 0 15%; - background: #FFF; - } diff --git a/Scripts/Webenv/Public/Stylesheet/forms.css b/Scripts/Webenv/Public/Stylesheet/forms.css deleted file mode 100755 index 9a39fc2..0000000 --- a/Scripts/Webenv/Public/Stylesheet/forms.css +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Webenv -> Forms - * - * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG - * - * This CSS 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 CSS 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, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * ---------------------------------------------------------------------- - * $Id$ - * ---------------------------------------------------------------------- - */ - -div#page-body div.row1 { - clear: both; - background: #F8F8F8; - padding: 10px; - } - -div#page-body div.row2 { - clear: both; - background: #FFFFFF; - padding: 10px; - } - -div#page-body div.row3 { - clear: both; - border-top: 1px solid #CCC; - padding: 10px; - margin-top: 10px; - } - -div#page-body fieldset div.row1 span.descrip, -div#page-body fieldset div.row2 span.descrip { - float: left; - } - -div#page-body fieldset div.field { - display: block; - margin-left: 30%; - } - -div#page-body fieldset div.field div.column { - float: left; - margin-right: 1em; - padding-right: 1em; - border-right: 1px dotted #AAA; - } - -div#page-body fieldset div.row3 div.descrip { - display: block; - font-size: small; - color: #AAA; - font-style: italic; - width: 70% - } - -div#page-body fieldset span.submit { - float: right; - } - -/* */ - -div#page-body form div { - padding-bottom: 10px; - } - -div#page-body form div span { - display: inline; - margin: 0; - padding-right: 10px; - } - -div#page-body div span.results { - padding-left: 10px; - border-left: 1px dotted #AAA; - } - -/* */ - - -/* */ - -div#page-body div.records-list { - display: block; - } - -div#page-body div.records-list ul { - margin: 0; - padding: 0; - list-style: none; - } - -div#page-body div.records-list ul li { - padding: 0.5em; - } - -div#page-body div.records-list ul li.row1 { - background: #F8F8F8; - } - -div#page-body div.records-list ul li span.col0 { - display: block; - float:left; - text-align: center; - padding-right: 0.5em; - margin-right: 0.5em; - border-right: 1px solid #FFF; - } - -div#page-body div.records-list ul li span.col1 { - width: 250px; - display: block; - float:left; - } - -div#page-body div.records-list ul li span.col2 { - border-left: 1px solid #FFF; - padding-left: 0.5em; - } - -div#page-body div.records-list ul li.title { - font-weight: bold; - background: #eee; - border-bottom: 1px #AAA solid; - } diff --git a/Scripts/Webenv/Public/Stylesheet/links.css b/Scripts/Webenv/Public/Stylesheet/links.css deleted file mode 100755 index d0ae637..0000000 --- a/Scripts/Webenv/Public/Stylesheet/links.css +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Webenv -> Links - * - * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG - * - * This CSS 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 CSS 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, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * ---------------------------------------------------------------------- - * $Id$ - * ---------------------------------------------------------------------- - */ - -/* Broken or nonexistent links. ---------------------------------------------------------------------*/ - -div#page-body a.nonexistent, -div#page-body a.nonexistent:hover { color: gray; } - -/* Special decoration for some links' classes ---------------------------------------------------------------------*/ - -div#page-body a.www:before { - white-space:nowrap; - content: url(/home/centos/artwork/trunk/Identity/Images/Webenv/a-www.png); - margin: 0 0.2em; - } - -div#page-body a.http:before { - white-space:nowrap; - content: url(/home/centos/artwork/trunk/Identity/Images/Webenv/a-www.png); - margin: 0 0.2em; - } - -div#page-body a.https:before { - white-space:nowrap; - content: url(/home/centos/artwork/trunk/Identity/Images/Webenv/a-www.png); - margin: 0 0.2em; - } - -div#page-body a.mailto:before { - white-space:nowrap; - content: url(/home/centos/artwork/trunk/Identity/Images/Webenv/a-mail.png); - margin: 0 0.2em; - } - -div#page-body a.attachment:before { - white-space:nowrap; - content: url(/home/centos/artwork/trunk/Identity/Images/Webenv/a-attach.png); - margin: 0 0.2em; - } diff --git a/Scripts/Webenv/Public/Stylesheet/lists.css b/Scripts/Webenv/Public/Stylesheet/lists.css deleted file mode 100755 index 703dccd..0000000 --- a/Scripts/Webenv/Public/Stylesheet/lists.css +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Webenv -> Lists - * - * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG - * - * This CSS 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 CSS 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, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * ---------------------------------------------------------------------- - * $Id$ - * ---------------------------------------------------------------------- - */ - -div#page-body ul { - /* - list-style: url("https://projects.centos.org/webenv-pub/Images/ul.png") disc; - */ - } - -div#page-body ul, -div#page-body ol { - margin-left: 2.5em; - } - -div#page-body ul ol, -div#page-body ol ul, -div#page-body dl ul, -div#page-body dl ol { - margin-left: 1.5em; - } - -div#page-body div#links ul { - padding: 0.5em 0.5em 1em 1em; - margin: 0; - list-style: none; - border-top: 1px #EEE solid; - } - -div#page-body div#links ul.first { - border-top: none; - } - -div#page-body div#links ul li { - padding: 2px; - } - -/* Table of content (toc) ---------------------------------------------------------------------*/ - -div#page-body div.toc { - font-size: small; - text-align:left; - margin-bottom: 2em; - } - -div#page-body div.toc p { - font-weight: bold; - margin: 0.5em 0 0.5em 0; - } - -div#page-body div#content div.toc dl { - margin: 0; - } - -div#page-body div#content div.toc dl dl { - margin-left: 2.5em; - } - -/* Content actions links (e.g., categories and archives). ---------------------------------------------------------------------*/ - -div#page-body div#content-actions dl { - margin-top: 0; - margin-left: 0; - } - -div#page-body div#content-actions dl dt { - font-weight: bold; - border-bottom: 1px solid #EEE; - margin-bottom: 1em; - } - -div#page-body div#content-actions dl dd { - margin-left: 1.5em; - } - -div#page-body div#content-actions dl dl { - margin-left: 1.5em; - margin-top: 0px; - border-top: none; - padding-top: 0; - } - -div#page-body div#content-actions dl dl.year { - margin-bottom: 1em; - } - -div#page-body div#content-actions dl dl.year dd { - margin-left: 0; - } diff --git a/Scripts/Webenv/Public/Stylesheet/reset.css b/Scripts/Webenv/Public/Stylesheet/reset.css deleted file mode 100755 index 6573975..0000000 --- a/Scripts/Webenv/Public/Stylesheet/reset.css +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Webenv (reset) -- This file resets the browser's default visual - * style and sets The CentOS Web Environment visual style as default - * visual style. This file sets default values to tags like `html', - * `body', as well as those controlling links, tables, paragrphs, - * headings, lists, forms and quotation. - * - * The CentOS Web Environment (Webenv) is specially conceived to - * achieve one unique visual style and easy navegation through all - * different web applications The CentOS Project uses to show its - * existence in the World Wide Web medium. - * - * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG - * - * This CSS 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 CSS 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, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * ------------------------------------------------------------------- - * $Id$ - * ------------------------------------------------------------------- - */ - - -/* Reset browsers default margins and paddings ------------------------------------------------*/ - -* { - margin: 0; - padding: 0; - } - -/* Define html ------------------------------------------------*/ - -html { - background-color: #FFF; - background-image: url("https://projects.centos.org/webenv-pub/Images/html-bg.png"); - } - -/* Define body ------------------------------------------------*/ - -body { - font-family: "DejaVu Sans", "Liberation Sans", sans-serif; - font-size: 0.85em; - /* margin: 0; /* <- full screen */ - /* margin: 0 1% 0 1%; /* <- with 1% of left and right margin */ - /* margin: 0 2% 0 2%; /* <- with 2% of left and right margin */ - margin: 0 3% 0 3%; /* <- with 3% of left and right margin */ - /* margin: 0 10% 0 10%; /* <- with 10% of left and right margin */ - color: #333; - } - -/* Links ------------------------------------------------*/ - -a:link { text-decoration: none; color: #0044B3; } -a:hover { text-decoration: underline; color: green; } -a:active { text-decoration: underline; color: green; } -a:visited { text-decoration: none; color: #0044B3; } -a:visited:hover { text-decoration: underline; color: green; } - -.title, -.title a:link, -.title a:active, -.title a:hover, -.title a:visited, -.title a:visited:hover { - /* color: #072B61; */ - color: #000000; - } - -/* Headings ------------------------------------------------*/ - -h1 { - font-size: 2em; - line-height: 1.3em; - } - -h2 { - font-size: 1.5em; - line-height: 1.5em; - margin-top: 1.5em; - } - -h3 { - font-size: 1.4em; - line-height: 1.4em; - margin-top: 1.4em; - } - -h4 { - font-size: 1.2em; - line-height: 1.2em; - margin-top: 1.2em; - } - -h5 { - font-size: 1.1em; - line-height: 1.1em; - margin-top: 1.1em; - } - -h6 { - font-size: 1em; - line-height: 1em; - margin-top: 1em; - } - -/* Paragraphs ------------------------------------------------*/ - -p { - margin: 1em 0 1.5em 0; - line-height: 1.5em; - text-align: justify; - } - -/* Images ------------------------------------------------*/ - -img { - border: none; - } - -/* Quotations ------------------------------------------------*/ - -blockquote { - background: #fafafa; - border-color: #eeeeee; - border-width: 1px; - border-style: solid; - border-left-width: 4px; - margin-left: 1.5em; - padding: 0.5em; - margin-top: 1em; - margin-bottom: 1.3em; - } - -q:before { - content: " “"; - } - -q:after { - content: "” "; - } - -q q:before { - content: " ‘"; - } - -q q:after { - content: "’ "; - } - -address { - margin-left: 1.5em; - } - -/* Preformatted Texts ------------------------------------------------*/ - -pre { - font-family: "DejaVu Sans Mono", "Liberation Mono", monospace; - padding: 0.5em 1em 0.5em 1em; - margin: 1em 0 1em 0; - white-space: pre; - border-width: 1px; - border-style: solid; - border-color: #E5E5E5; - border-left-width: 4px; - background: #FFFAE9; - overflow: auto; - } - -/* Phrase Elements ------------------------------------------------*/ - -tt, -samp, -kbd, -code { - font-family: "DejaVu Sans Mono", "Liberation Mono", monospace; - } - -/* Page Lines ------------------------------------------------*/ - -hr { - clear: both; - height: 1px ! important; - border: none; - background-color: #DADADA; - } - -/* Lists ------------------------------------------------*/ - -ul, -ol, -dl { - margin: 1.5em 0 1.5em 2.5em; - } - -ul { - list-style: disc; - } - -ol { - list-style-image: none !important; - } - -ul li, -ol li { - line-height: 1.5em; - } - -ul ul, -ul ol, -ol ul, -ol ol { - margin-top: 0.3em; - margin-bottom: 0.3em; - } - -ul li p, -ol li p { - margin-bottom: 0.3em; - } - -dl dd { - margin-left: 2.5em; - } - -dl ol, -dl ul { - margin-left: 3.5em; - } - -/* Tables ------------------------------------------------*/ - -table { - border-collapse: collapse; - } - -table caption { - font-style: italic; - text-align: center; - } - -table tr th { - font-weight: bold; - } - -table tr td, -table tr th { - border: 1pt; - border-style: solid; - border-color: #CCC; - padding-top: 0.25em; - padding-right: 0.5em; - padding-bottom: 0.25em; - padding-left: 0.5em; - vertical-align: top; - } - -table tr td p, -table tr td pre { - margin: 0; - padding: 0; - } - -/* Forms ------------------------------------------------*/ - -form { - display: inline; - } - -input[type="submit"], -input[type="button"] { - padding: 1px; - display: inline; - text-decoration: none; - } - -input[type="text"], -input[type="password"], -textarea { - display: inline; - padding: 2px; - } - -select { - display: inline; - padding: 1px; - } - -form p { - display: inline; - margin-left: 5px; - margin-right: 5px; - } - -/* Select ----------------------------------------- */ - -select option { - padding-left: 3px; - padding-right: 3px; - } - -select optgroup { - font-style: normal; - font-weight: bold; - padding-left: 3px; - } - -select optgroup option { - margin-left: 1em; - } - -input[type="radio"], -input[type="checkbox"] { - vertical-align: middle; - } - -fieldset { - margin: 1em 0 1em 0; - padding: 1em; - padding-bottom: 5px; - border: 1px solid #AAA; - } - -fieldset legend { - font-weight: bold; - color: #AAA; - } diff --git a/Scripts/Webenv/Public/Stylesheet/tabs.css b/Scripts/Webenv/Public/Stylesheet/tabs.css deleted file mode 100755 index 83230a6..0000000 --- a/Scripts/Webenv/Public/Stylesheet/tabs.css +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Webenv -> Tabs (Style 2: Two Rounded Borders) - * - * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG - * - * This CSS 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 CSS 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, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * ---------------------------------------------------------------------- - * $Id$ - * ---------------------------------------------------------------------- - */ - -div#page-header div.tabs { - margin-left: 10px; - margin-right: 10px; - } - -div#page-header div.tabs a { - color: #FFF; - float: left; - font-weight: bold; - margin-right: 3px; - padding: 0px 8px 0 0px; - text-decoration: none; - } - -div#page-header div.tabs span.current a, -div#page-header div.tabs span.current a:hover, -div#page-header div.tabs span.current a span, -div#page-header div.tabs span.current a:hover span { - color: #204A87; - text-decoration: none; - } - -div#page-header div.tabs a span { - float: left; - padding: 5px 0px 3px 8px; - } - -/* */ - -div#page-header div.tabs a { - background: none; - } - -div#page-header div.tabs a span { - background: none; - } - -div#page-header div.tabs span.current a, -div#page-header div.tabs span.current a:hover { - background: url("https://projects.centos.org/webenv-pub/Images/tabs-bg-1.png") 100% -50px no-repeat; - } - -div#page-header div.tabs span.current a span, -div#page-header div.tabs span.current a:hover span { - background: url("https://projects.centos.org/webenv-pub/Images/tabs-bg-2.png") 0 -50px no-repeat; - } - -div#page-header div.tabs span:hover a { - background: url("https://projects.centos.org/webenv-pub/Images/tabs-bg-1.png") 100% 0 no-repeat; - } - -div#page-header div.tabs span:hover a span { - background: url("https://projects.centos.org/webenv-pub/Images/tabs-bg-2.png") 0 0; - } - -/* Application level navigation bar. ---------------------------------------------------------------------*/ -div#page-header div#appslinks div.tabs span:hover a span { - } diff --git a/Scripts/Webenv/Public/stylesheet.css b/Scripts/Webenv/Public/stylesheet.css deleted file mode 100755 index c4ecbf7..0000000 --- a/Scripts/Webenv/Public/stylesheet.css +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Webenv - * - * Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG - * - * This CSS 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 CSS 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, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * ---------------------------------------------------------------------- - * $Id$ - * ---------------------------------------------------------------------- - */ - -/* Reset browser's default definitions. ---------------------------------------------------------------------*/ -@import url("https://projects.centos.org/webenv-pub/Stylesheet/reset.css"); - -/* Customize default definitions. ---------------------------------------------------------------------*/ -@import url("https://projects.centos.org/webenv-pub/Stylesheet/base.css"); -@import url("https://projects.centos.org/webenv-pub/Stylesheet/links.css"); -@import url("https://projects.centos.org/webenv-pub/Stylesheet/lists.css"); -@import url("https://projects.centos.org/webenv-pub/Stylesheet/admonition.css"); -@import url("https://projects.centos.org/webenv-pub/Stylesheet/forms.css"); - -/* Miscellaneous definitions. ---------------------------------------------------------------------*/ -@import url("https://projects.centos.org/webenv-pub/Stylesheet/tabs.css"); diff --git a/Scripts/Webenv/webenv.cgi b/Scripts/Webenv/webenv.cgi deleted file mode 100755 index d137638..0000000 --- a/Scripts/Webenv/webenv.cgi +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/python -# -# centos-web.cgi -- This script is an effort to organize The CentOS -# Project information in XHTML format for its publication on the -# Internet. The script is organized in a package named `Apps' which, -# in turn, is subdivided in other packages (e.g., `Home', `Sponsors', -# etc.) to cover each web application the organization demands. -# -# Notice that some of the web applications demanded (e.g., Wiki, -# Lists, Forums, Bugs, etc.) are not included in this script, but -# linked to their own locations. Moreover, in order to provide -# accessability among all different web applications, they need to be -# redesigned to share one unique visual style and one unique top-level -# navigation bar so the current web application can be remarked. -# -# Copyright (C) 2011 Alain Reguera Delgado -# -# 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, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ------------------------------------------------------------------ -# $Id$ -# ------------------------------------------------------------------ - -import cgi -import cgitb; cgitb.enable() - -def main(): - - qs = cgi.parse() - - if 'app' in qs: - app = qs['app'][0].lower() - else: - app = 'home' - - if app == 'home': - from Apps.Home import page - elif app == 'sponsors': - from Apps.Sponsors import page - else: - from Apps.Unknown import page - - print 'Content-type: text/html' + "\n" - print page.main() - -if __name__ == '__main__': main() diff --git a/Scripts/Webenv/webenv.conf b/Scripts/Webenv/webenv.conf deleted file mode 100644 index 83b4ce8..0000000 --- a/Scripts/Webenv/webenv.conf +++ /dev/null @@ -1,33 +0,0 @@ -# webenv.conf -- This file provides the configuration required by -# Apache HTTP server in order for `webenv.cgi' script to be able of -# running through it. -# -# The configuration provided by this file assumes that you've -# installed the Apache HTTP server in your workstation and have also -# configured it to public content inside the `public_html' directory -# inside the user's home directory. This configuration is mainly for -# developers whom have downloaded a working copy of `webenv.cgi' tree -# into their worstation in order to on it in a way that it be possible -# to test changes before commit them up to the central repository. -# -# To install this configuration, copy this file to -# `/etc/httpd/conf.d/' and, after that, reload the httpd server deamon -# (e.g., /sbin/service httpd reload). -# -# To test the changes you've made in your working copy directory, -# related to `webenv.cgi' tree, open the address -# `http://localhost/webenv/' in your web browser and explore the -# application looking for them. -# -# ------------------------------------------------------------------ -# $Id$ -# ------------------------------------------------------------------ - -# Define the CGI script location. Be sure to use the script file, not -# the directory where the script file is stored in. This way, the -# security issues are reduced to that CGI script you refered to. -ScriptAliasMatch ^/webenv/(.*)$ "/home/centos/public_html/Webenv/webenv.cgi" - -# Define the CGI public location. This is the location where public -# files (e.g., images and css files) are stored in. -Alias /webenv-pub/ "/home/centos/public_html/Webenv/Public/"