Changes between Version 1 and Version 2 of Карактеристики на продуктот


Ignore:
Timestamp:
11/18/15 14:25:23 (8 years ago)
Author:
123009
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Карактеристики на продуктот

    v1 v2  
    1 = Trac Macros
     1= Карактеристики на продуктот =
    22
    3 [[PageOutline]]
     3Online книжарницата им нуди на корисниците централизирано место за пребарување и купување книги. Карактеристиките на сервисот се приоретизирани на следниот начин:
    44
    5 Trac macros are plugins to extend the Trac engine with custom 'functions' written in Python. A macro inserts dynamic HTML data in any context supporting WikiFormatting. Its syntax is `[[macro-name(optional-arguments)]]`.
    6 
    7 The WikiProcessors are another kind of macros. They typically deal with alternate markup formats and transformation of larger "blocks" of information, like source code highlighting. They are used for processing the multiline `{{{#!wiki-processor-name ... }}}` blocks.
    8 
    9 == Using Macros
    10 
    11 Macro calls are enclosed in two ''square brackets'' `[[..]]`. Like Python functions, macros can also have arguments, a comma separated list within parentheses `[[..(,)]]`.
    12 
    13 === Getting Detailed Help
    14 
    15 The list of available macros and the full help can be obtained using the !MacroList macro, as seen [#AvailableMacros below].
    16 
    17 A brief list can be obtained via `[[MacroList(*)]]` or `[[?]]`.
    18 
    19 Detailed help on a specific macro can be obtained by passing it as an argument to !MacroList, e.g. `[[MacroList(MacroList)]]`, or, more conveniently, by appending a question mark (`?`) to the macro's name, like in `[[MacroList?]]`.
    20 
    21 === Example
    22 
    23 A list of the 3 most recently changed wiki pages starting with 'Trac':
    24 
    25 ||= Wiki Markup =||= Display =||
    26 {{{#!td
    27   {{{
    28   [[RecentChanges(Trac,3)]]
    29   }}}
     5{{{#!th align=left style="background: #ffd"
     6Ниво на приоритет
    307}}}
    31 {{{#!td style="padding-left: 2em;"
    32 [[RecentChanges(Trac,3)]]
     8{{{#!th align=left style="background: #ffd"
     9Опис
    3310}}}
    34 |-----------------------------------
    35 {{{#!td
    36   {{{
    37   [[RecentChanges?(Trac,3)]]
    38   }}}
     11|----------------------------------
     12{{{#!td align=left
     13Приоритет 1
    3914}}}
    40 {{{#!td style="padding-left: 2em;"
    41 [[RecentChanges?(Trac,3)]]
     15{{{#!td align=left
     16Функционалност од суштинско значење
    4217}}}
    43 |-----------------------------------
    44 {{{#!td
    45   {{{
    46   [[?]]
    47   }}}
     18|----------------------------------
     19{{{#!td align=left
     20Приоритет 2
    4821}}}
    49 {{{#!td style="padding-left: 2em"
    50 {{{#!html
    51 <div style="font-size: 80%" class="trac-macrolist">
    52 <h3><code>[[Image]]</code></h3>Embed an image in wiki-formatted text.
    53 
    54 The first argument is the file …
    55 <h3><code>[[InterTrac]]</code></h3>Provide a list of known <a class="wiki" href="/wiki/InterTrac">InterTrac</a> prefixes.
    56 <h3><code>[[InterWiki]]</code></h3>Provide a description list for the known <a class="wiki" href="/wiki/InterWiki">InterWiki</a> prefixes.
    57 <h3><code>[[KnownMimeTypes]]</code></h3>List all known mime-types which can be used as <a class="wiki" href="/wiki/WikiProcessors">WikiProcessors</a>.
    58 Can be …</div>
     22{{{#!td align=left
     23Пожелна функционалност
    5924}}}
    60 etc.
     25|----------------------------------
     26{{{#!td align=left
     27Приоритет 3
     28}}}
     29{{{#!td align=left
     30Дополнителни функции
    6131}}}
    6232
    63 == Available Macros
     33Карактеристики кои се однесуваат на купувачите кои ќе го користат сајтот:
    6434
    65 ''Note that the following list will only contain the macro documentation if you've not enabled `-OO` optimizations, or not set the `PythonOptimize` option for [wiki:TracModPython mod_python].''
     35- '''Регистрација'''  \\
     36''Приоритет 1:'' Секој корисник ќе треба да се регистрира со валидна мејл адреса и лозинка со што ќе се креира личен профил. Корисникот ќе треба да ги внесе своите лични податоци како што се име, презиме и адреса на живеење. Внесот на информациите за кредитната картичка ќе се прави при секое купување на книга.
    6637
    67 [[MacroList]]
     38- '''Пребарување на книги''' \\
     39''Приоритет 1:'' Пребарувањето на книги ќе може да се прави преку внесување на автор, наслов и/или одбирање на веќе предефинирана категорија/жанр.
    6840
    69 == Macros from around the world
     41- '''Додавање на книги во листа со желби''' \\
     42''Приоритет 1:'' Корисникот ќе може да додаде неограничен број на книги во својата листа со желби. Книгата автоматски ќе се тргне од листата доколку корисникот ја купи истата.
    7043
    71 The [http://trac-hacks.org/ Trac Hacks] site provides a wide collection of macros and other Trac [TracPlugins plugins] contributed by the Trac community. If you are looking for new macros, or have written one that you would like to share with the world, don't hesitate to visit that site.
     44- '''Купување на книги''' \\
     45''Приоритет 1:'' Купувањето на книги би се одвивало преку плаќање со кредитна картичка. \\
     46''Приоритет 3'': При самото уплаќање корисникот може да ја означи книгата како поклон. Во тој случај треба да ја внесе адресата за достава и името на испраќачот. Книгата ќе биде доставена во украсна хартија и заедно со неа ќе има посвета со името на испраќачот.
    7247
    73 == Developing Custom Macros
     48- '''Оценување на книгите''' \\
     49''Приоритет 2:'' Оценувањето на книгите може да се врши преку давање rating и/или review за одредена книга. Овие оцени ќе бидат достапни за сите корисници. \\
     50''Приоритет 3:'' Секој месец ќе се објавува листа на најдобро оценетите книги.
    7451
    75 Macros, like Trac itself, are written in the [http://python.org/ Python programming language] and are developed as part of TracPlugins.
     52- '''Препорачување книга''' \\
     53''Приоритет 3:'' Препорачувањето на книга ќе може да се врши на два начина и тоа, препорачување на одредена личност преку порака или споделување на книгата на некоја од социјалните мрежи.
    7654
    77 For more information about developing macros, see the [trac:TracDev development resources] on the main project site.
     55- '''Преглед на нови книги''' \\
     56''Приоритет 1:'' Корисникот ќе може да ги разгледува новите најавени книги. Исто така ќе пишува и кога ќе започне продажбата на некоја нова книга. Доколку корисникот стави во листата со желби некоја од новите книги ќе добие потсетување преку мејл дека книгата е пуштена во продажба.
    7857
    79 Here are 2 simple examples showing how to create a Macro. Also, have a look at [trac:source:tags/trac-1.0.2/sample-plugins/Timestamp.py Timestamp.py] for an example that shows the difference between old style and new style macros and at the [trac:source:tags/trac-0.11/wiki-macros/README macros/README] which provides a little more insight about the transition.
     58- '''Преглед на најкупувани книги''' \\
     59''Приоритет 3:'' Ќе се овозможи преглед на најкупуваните книги за изминатиот месец.
    8060
    81 === Macro without arguments
     61- '''Прикажување колекции''' \\
     62''Приоритет 1:'' Доколку одредена книга е дел од некоја колекција на корисникот ќе му се даде можност за купување на целата колекција или поединечна книга.
    8263
    83 To test the following code, you should saved it in a `timestamp_sample.py` file located in the TracEnvironment's `plugins/` directory.
    84 {{{
    85 #!python
    86 from datetime import datetime
    87 # Note: since Trac 0.11, datetime objects are used internally
     64- '''Систем за препораки''' \\
     65''Приоритет 1:'' Системот ќе препорачува книги врз оснава на претходни купувања и/или пребарувања на корисникот.
    8866
    89 from genshi.builder import tag
     67Карактеристики кои се однесуваат на менаџерите на сајтот (сите карактеристики се со приоритет 1):
    9068
    91 from trac.util.datefmt import format_datetime, utc
    92 from trac.wiki.macros import WikiMacroBase
     69- '''Преглед на залихи''' \\
     70Менаџерот ќе може да врши преглед на залихите на одредена книга и ќе биде известен доколку одредена книга е потрошена.
    9371
    94 class TimeStampMacro(WikiMacroBase):
    95     """Inserts the current time (in seconds) into the wiki page."""
     72- '''Преглед на нарачки''' \\
     73Менаџерот ќе може да ги прегледува нарачките според градови и големина на нарачка.
    9674
    97     revision = "$Rev$"
    98     url = "$URL$"
    99 
    100     def expand_macro(self, formatter, name, text):
    101         t = datetime.now(utc)
    102         return tag.strong(format_datetime(t, '%c'))
    103 }}}
    104 
    105 === Macro with arguments
    106 
    107 To test the following code, you should save it in a `helloworld_sample.py` file located in the TracEnvironment's `plugins/` directory.
    108 {{{
    109 #!python
    110 from genshi.core import Markup
    111 
    112 from trac.wiki.macros import WikiMacroBase
    113 
    114 class HelloWorldMacro(WikiMacroBase):
    115     """Simple HelloWorld macro.
    116 
    117     Note that the name of the class is meaningful:
    118      - it must end with "Macro"
    119      - what comes before "Macro" ends up being the macro name
    120 
    121     The documentation of the class (i.e. what you're reading)
    122     will become the documentation of the macro, as shown by
    123     the !MacroList macro (usually used in the WikiMacros page).
    124     """
    125 
    126     revision = "$Rev$"
    127     url = "$URL$"
    128 
    129     def expand_macro(self, formatter, name, text, args):
    130         """Return some output that will be displayed in the Wiki content.
    131 
    132         `name` is the actual name of the macro (no surprise, here it'll be
    133         `'HelloWorld'`),
    134         `text` is the text enclosed in parenthesis at the call of the macro.
    135           Note that if there are ''no'' parenthesis (like in, e.g.
    136           [[HelloWorld]]), then `text` is `None`.
    137         `args` are the arguments passed when HelloWorld is called using a
    138         `#!HelloWorld` code block.
    139         """
    140         return 'Hello World, text = %s, args = %s' % \
    141             (Markup.escape(text), Markup.escape(repr(args)))
    142 
    143 }}}
    144 
    145 Note that `expand_macro` optionally takes a 4^th^ parameter ''`args`''. When the macro is called as a [WikiProcessors WikiProcessor], it's also possible to pass `key=value` [WikiProcessors#UsingProcessors processor parameters]. If given, those are stored in a dictionary and passed in this extra `args` parameter. On the contrary, when called as a macro, `args` is  `None`. (''since 0.12'').
    146 
    147 For example, when writing:
    148 {{{
    149 {{{#!HelloWorld style="polite" -silent verbose
    150 <Hello World!>
    151 }}}
    152 
    153 {{{#!HelloWorld
    154 <Hello World!>
    155 }}}
    156 
    157 [[HelloWorld(<Hello World!>)]]
    158 }}}
    159 One should get:
    160 {{{
    161 Hello World, text = <Hello World!> , args = {'style': u'polite', 'silent': False, 'verbose': True}
    162 Hello World, text = <Hello World!> , args = {}
    163 Hello World, text = <Hello World!> , args = None
    164 }}}
    165 
    166 Note that the return value of `expand_macro` is '''not''' HTML escaped. Depending on the expected result, you should escape it by yourself (using `return Markup.escape(result)`) or, if this is indeed HTML, wrap it in a Markup object (`return Markup(result)`) with `Markup` coming from Genshi, (`from genshi.core import Markup`). 
    167 
    168 You can also recursively use a wiki Formatter (`from trac.wiki import Formatter`) to process the `text` as wiki markup:
    169 
    170 {{{
    171 #!python
    172 from genshi.core import Markup
    173 from trac.wiki.macros import WikiMacroBase
    174 from trac.wiki import Formatter
    175 import StringIO
    176 
    177 class HelloWorldMacro(WikiMacroBase):
    178     def expand_macro(self, formatter, name, text, args):
    179         text = "whatever '''wiki''' markup you want, even containing other macros"
    180         # Convert Wiki markup to HTML, new style
    181         out = StringIO.StringIO()
    182         Formatter(self.env, formatter.context).format(text, out)
    183         return Markup(out.getvalue())
    184 }}}
     75- '''Менаџирање на книгите во продажба''' \\
     76Менаџерот може да додаде или да тргне одредена книга од продажба. Исто така ќе може да ја менува цената на книгата доколку истата се променила или книгата е ставена на попуст/промоција.