<commit_before>.. _section-mobiweb-news:

================
News Office
================

Displays the most current articles from the MIT News Office.
User can select articles by category (Top News, Campus, Engineering, 
Science, Management, Architecture, and Humanities), or users
can search for articles with search terms.  

----------------------------
Data Sources / Configuration
----------------------------

^^^^^^^^^^^^^^^^^^^^
News Office XML feed
^^^^^^^^^^^^^^^^^^^^

The MIT News Office publishes an XML feed, that allows
retrieval of news articles by category type or search terms.

News article by category are obtained by sending a query similar to
the following::

  http://web.mit.edu/newsoffice/feeds/iphone.php
    ?category=3
    &story_id=15451

The above query sends back XML for up to 200 stories that looks like:

.. code-block:: xml

   <items lastModified='1277305204'>
      <item> 
         <title><![CDATA[<NAME> in conversation with <NAME>]]></title> 
         <author><![CDATA[]]></author> 
         <category>3</category> 
         <link>http://web.mit.edu/newsoffice/2010/mitworld-porter-anderson.html</link> 
         <story_id>15425</story_id> 
         <featured>0</featured> 
         <description><![CDATA[Presented by MIT Sloan School of Management Dean's Innovative Leader Series]]></description> 
         <postDate>Wed, 09 Jun 2010 12:31:31 EDT </postDate> 
         <body><![CDATA[><blockquote>“It’s a case where the entrepreneur wants to 
                build a business, and is  madly in love with a great concept, and 
                the VC wants to make a quick  buck. It’s a partnership, but the 
                guy with control is the guy with  bucks. That’s not a good recipe. ... 
                You have a dichotomy of interests.”<br /> — <NAME></blockquote> 
         </body>
       </item>
       <item> 
          <title><![CDATA[MIT Portugal venture competition aims to connect innovators with investors]]></title> 
          <author><![CDATA[]]></author> 
          <category>3</category> 
          <link>http://web.mit.edu/newsoffice/2010/iei-venture-competition.html</link> 
          <story_id>15419</story_id> 
          <featured>0</featured> 
          <description><![CDATA[]]></description> 
          <postDate>Fri, 04 Jun 2010 19:54:51 EDT </postDate> 
          <image> 
             <thumbURL>http://web.mit.edu/newsoffice/images/article_images/w76/20100604160617-1.png</thumbURL> 
             <smallURL width='140' height='140'>http://web.mit.edu/newsoffice/images/article_images/w140/20100604160617-1.jpg</smallURL> 
             <fullURL width='368' height='368'>http://web.mit.edu/newsoffice/images/article_images/20100604160617-1.jpg</fullURL> 
          </image> 
          <body><![CDATA[The ISCTE-IUL MIT Portugal Competition — launched by ISCTE-IUL 
                 in partnership with MIT School of Engineering, the Deshpande Center, 
                 ...
          </body>
       <item> 
       ...
   </items>

If you do not specify ``category`` stories from all categories are returned.  
Only stories older than ``story_id`` are returned, if you
do not include this parameter, the most recent stories are
returned.

Search results are obtained with::

   http://web.mit.edu/newsoffice/index.php
       ?option=com_search
       &view=isearch
       &searchword=quarks
       &ordering=newest
       &start=0
       &limit=3

The above query sends back an XML result that looks like:

.. code-block:: xml

   <items lastModified='1277307134' totalResults='38'> 
      <item> 
         <title><![CDATA[Explained: Quark gluon plasma]]></title> 
         <author><![CDATA[<NAME>, MIT News Office]]></author> 
         <link><![CDATA[http://web.mit.edu/newsoffice/2010/exp-quark-gluon-0609.html]]></link> 
         <story_id>15427</story_id> 
         <description><![CDATA[By colliding particles, physicists hope to recreate the earliest moments of our universe, on a much smaller scale.]]></description> 
         <postDate>Wed, 09 Jun 2010 04:00:00 EDT </postDate> 
         <image> 
            <thumbURL>http://web.mit.edu/newsoffice/images/article_images/w76/20100608165022-1.png</thumbURL> 
            <smallURL width='140' height='112'>http://web.mit.edu/newsoffice/images/article_images/w140/20100608165022-1.jpg</smallURL> 
            <fullURL width='368' height='296'>http://web.mit.edu/newsoffice/images/article_images/20100608165022-1.jpg</fullURL> 
         </image> 
         <body><![CDATA[For a few millionths of a second after the Big Bang, 
            ...
         </body>
      </item>
      ...
   </items>

In this XML one can see there are a total of 38 stories matching the query,
but the XML itself will only contain 3 stories because of ``limit`` parameter,
and it starts from the most recent story, because ``start`` is 0.

^^^^^^^^^^^^^^^^^^^^^
mobi-lib dependencies
^^^^^^^^^^^^^^^^^^^^^

* :ref:`subsection-mobiweb-NewsOffice`

-----------
Logic Files
-----------

^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/index.php
^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/channels.php
^^^^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/detail.php
^^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/photo.php
^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/story_request_lib.php
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Functions to construct URLs for news article categories,
search results, or specific story.  The URLs are constructed
from the data in the HTTP Request.

--------------
Template Files
--------------

^^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/\*/index.html
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Shows a list stories by category or search results.
The Webkit version uses Javascript to load more
stories in place

^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/\*/detail.html
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Shows the detail version of the story, and includes
links to see the full size version of the story
photos


^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/\*/photo.html
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Display the photos from a specific story


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/\*/news.css<commit_msg>added a couple details to the mobiweb news module docs<commit_after>.. _section-mobiweb-news:

================
News Office
================

Displays the most current articles from the MIT News Office.
User can select articles by category (Top News, Campus, Engineering, 
Science, Management, Architecture, and Humanities), or users
can search for articles with search terms.  

----------------------------
Data Sources / Configuration
----------------------------

^^^^^^^^^^^^^^^^^^^^
News Office XML feed
^^^^^^^^^^^^^^^^^^^^

The MIT News Office publishes an XML feed, that allows
retrieval of news articles by category type or search terms.

News article by category are obtained by sending a query similar to
the following::

  http://web.mit.edu/newsoffice/feeds/iphone.php
    ?category=3
    &story_id=15451

The above query sends back XML for up to 200 stories that looks like:

.. code-block:: xml

   <items lastModified='1277305204'>
      <item> 
         <title><![CDATA[<NAME> in conversation with <NAME>]]></title> 
         <author><![CDATA[]]></author> 
         <category>3</category> 
         <link>http://web.mit.edu/newsoffice/2010/mitworld-porter-anderson.html</link> 
         <story_id>15425</story_id> 
         <featured>0</featured> 
         <description><![CDATA[Presented by MIT Sloan School of Management Dean's Innovative Leader Series]]></description> 
         <postDate>Wed, 09 Jun 2010 12:31:31 EDT </postDate> 
         <body><![CDATA[><blockquote>“It’s a case where the entrepreneur wants to 
                build a business, and is  madly in love with a great concept, and 
                the VC wants to make a quick  buck. It’s a partnership, but the 
                guy with control is the guy with  bucks. That’s not a good recipe. ... 
                You have a dichotomy of interests.”<br /> — <NAME></blockquote> 
         </body>
       </item>
       <item> 
          <title><![CDATA[MIT Portugal venture competition aims to connect innovators with investors]]></title> 
          <author><![CDATA[]]></author> 
          <category>3</category> 
          <link>http://web.mit.edu/newsoffice/2010/iei-venture-competition.html</link> 
          <story_id>15419</story_id> 
          <featured>0</featured> 
          <description><![CDATA[]]></description> 
          <postDate>Fri, 04 Jun 2010 19:54:51 EDT </postDate> 
          <image> 
             <thumbURL>http://web.mit.edu/newsoffice/images/article_images/w76/20100604160617-1.png</thumbURL> 
             <smallURL width='140' height='140'>http://web.mit.edu/newsoffice/images/article_images/w140/20100604160617-1.jpg</smallURL> 
             <fullURL width='368' height='368'>http://web.mit.edu/newsoffice/images/article_images/20100604160617-1.jpg</fullURL> 
          </image> 
          <body><![CDATA[The ISCTE-IUL MIT Portugal Competition — launched by ISCTE-IUL 
                 in partnership with MIT School of Engineering, the Deshpande Center, 
                 ...
          </body>
       <item> 
       ...
   </items>

If you do not specify ``category`` stories from all categories are returned.  
Only stories older than ``story_id`` are returned, if you
do not include this parameter, the most recent stories are
returned.

Search results are obtained with::

   http://web.mit.edu/newsoffice/index.php
       ?option=com_search
       &view=isearch
       &searchword=quarks
       &ordering=newest
       &start=0
       &limit=3

The above query sends back an XML result that looks like:

.. code-block:: xml

   <items lastModified='1277307134' totalResults='38'> 
      <item> 
         <title><![CDATA[Explained: Quark gluon plasma]]></title> 
         <author><![CDATA[<NAME>, MIT News Office]]></author> 
         <link><![CDATA[http://web.mit.edu/newsoffice/2010/exp-quark-gluon-0609.html]]></link> 
         <story_id>15427</story_id> 
         <description><![CDATA[By colliding particles, physicists hope to recreate the earliest moments of our universe, on a much smaller scale.]]></description> 
         <postDate>Wed, 09 Jun 2010 04:00:00 EDT </postDate> 
         <image> 
            <thumbURL>http://web.mit.edu/newsoffice/images/article_images/w76/20100608165022-1.png</thumbURL> 
            <smallURL width='140' height='112'>http://web.mit.edu/newsoffice/images/article_images/w140/20100608165022-1.jpg</smallURL> 
            <fullURL width='368' height='296'>http://web.mit.edu/newsoffice/images/article_images/20100608165022-1.jpg</fullURL> 
         </image> 
         <body><![CDATA[For a few millionths of a second after the Big Bang, 
            ...
         </body>
      </item>
      ...
   </items>

In this XML one can see there are a total of 38 stories matching the query,
but the XML itself will only contain 3 stories because of ``limit`` parameter,
and it starts from the most recent story, because ``start`` is 0.

^^^^^^^^^^^^^^^^^^^^^
mobi-lib dependencies
^^^^^^^^^^^^^^^^^^^^^

* :ref:`subsection-mobiweb-NewsOffice`

-----------
Logic Files
-----------

^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/index.php
^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/channels.php
^^^^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/detail.php
^^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/photo.php
^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/story_request_lib.php
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Functions to construct URLs for news article categories,
search results, or specific story.  The URLs are constructed
from the data in the HTTP Request.

.. function:: newsHomeQuery()

   Returns the query string needed to get back to the most
   recent state of news "home" page.

.. function:: searchQuery()

   Returns the query string needed to get back to the most
   recent state of the news search results page.
   
--------------
Template Files
--------------

^^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/\*/index.html
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Shows a list stories by category or search results.
The Webkit version uses Javascript to load more
stories in place

^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/\*/detail.html
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Shows the detail version of the story, and includes
links to see the full size version of the story
photos


^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/\*/photo.html
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Display the photos from a specific story


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mobi-web/news/\*/news.css
{'fraction_non_alphanumeric': 0.20730938878386893, 'fraction_numerical': 0.036546943919344675, 'mean_word_length': 2.961622464898596, 'pattern_counts': {'":': 0, '<': 195, '<?xml version=': 0, '>': 191, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4125218', 'n_tokens_mistral': 4165, 'n_tokens_neox': 3691, 'n_words': 1024}