OSDN Git Service

「新着情報」ウィジェット更新。
authornaoki hirata <naoki@magic3.org>
Tue, 1 Jul 2014 11:31:59 +0000 (20:31 +0900)
committernaoki hirata <naoki@magic3.org>
Tue, 1 Jul 2014 11:31:59 +0000 (20:31 +0900)
include/sql/update_widgets.sql
widgets/whatsnew/include/container/admin_whatsnewWidgetContainer.php
widgets/whatsnew/include/container/rss_whatsnewWidgetContainer.php [new file with mode: 0644]
widgets/whatsnew/include/container/whatsnewWidgetContainer.php
widgets/whatsnew/include/template/admin.tmpl.html
widgets/whatsnew/include/template/admin_list.tmpl.html
widgets/whatsnew/include/template/index.tmpl.html
widgets/whatsnew/include/template/rss_index.tmpl.html [new file with mode: 0644]

index d74814f..df1c688 100644 (file)
@@ -217,8 +217,8 @@ INSERT INTO _widgets
 ('calendar', '汎用カレンダー', 'calendar',      'subcontent',   true, '1.0.0',    'Naoki Hirata', 'Magic3.org', 'GPL',      10,                '様々な情報をカレンダー表示する汎用カレンダー機能', 'jquery.fullcalendar,jquery.qtip',                'datetype_detail=jquery.tablednd,jquery.timepicker;date_detail=jquery-ui.datepicker,jquery-ui.dialog,jquery.timepicker,jquery.tablednd,jquery.json;event_detail=ckeditor_m3toolbar;',   true,                true, true,         true,                true,  0,         1, '2013-10-17', now(),         now());\r
 DELETE FROM _widgets WHERE wd_id = 'whatsnew';\r
 INSERT INTO _widgets\r
-(wd_id,      wd_name,    wd_status, wd_content_type, wd_category_id, wd_edit_content, wd_content_widget_id, wd_version, wd_author,      wd_copyright, wd_license, wd_official_level, wd_description, wd_add_script_lib, wd_add_script_lib_a, wd_has_admin, wd_use_instance_def, wd_initialized, wd_release_dt, wd_install_dt, wd_create_dt) VALUES\r
-('whatsnew', '新着情報-簡易', 1, 'news',          'subcontent',   true,  'default_news',          '1.0.0b',   'Naoki Hirata', 'Magic3.org', 'GPL',      10,                'サイトの最新情報をリスト表示する。', '',                '',                 true,         true,                true,  '2014-06-30', now(),         now());\r
+(wd_id,      wd_name,    wd_status, wd_content_type, wd_category_id, wd_edit_content, wd_content_widget_id, wd_version, wd_author,      wd_copyright, wd_license, wd_official_level, wd_description, wd_add_script_lib, wd_add_script_lib_a, wd_has_admin, wd_enable_operation, wd_use_instance_def, wd_initialized, wd_release_dt, wd_install_dt, wd_create_dt) VALUES\r
+('whatsnew', '新着情報-簡易', 1, 'news',          'subcontent',   true,  'default_news',          '1.0.0b',   'Naoki Hirata', 'Magic3.org', 'GPL',      10,                'サイトの最新情報をリスト表示する。', '',                '',                 true,  true,       true,                true,  '2014-06-30', now(),         now());\r
 DELETE FROM _widgets WHERE wd_id = 'default_news';\r
 INSERT INTO _widgets\r
 (wd_id,      wd_name,    wd_status, wd_content_type, wd_category_id, wd_edit_content, wd_content_widget_id, wd_version, wd_author,      wd_copyright, wd_license, wd_official_level, wd_description, wd_add_script_lib, wd_add_script_lib_a, wd_available, wd_has_admin, wd_use_instance_def, wd_initialized, wd_release_dt, wd_install_dt, wd_create_dt) VALUES\r
index 579165d..2704084 100644 (file)
  * @link       http://www.magic3.org
  */
 require_once($gEnvManager->getContainerPath() . '/baseAdminWidgetContainer.php');
-require_once($gEnvManager->getCurrentWidgetDbPath() . '/whatsnewDb.php');
+require_once($gEnvManager->getCurrentWidgetDbPath()    . '/whatsnewDb.php');
 
 class admin_whatsnewWidgetContainer extends BaseAdminWidgetContainer
 {
        private $db;    // DB接続オブジェクト
-       private $serialNo;              // 選択中の項目のシリアル番号
-       private $serialArray = array();                 // 表示中のシリアル番号
        private $langId;
-       private $paramObj;              // パラメータ保存用オブジェクト
-       const CONTENT_TYPE = 'news';                    // コンテンツタイプ
+       const DEFAULT_ITEM_COUNT = 10;          // デフォルトの表示項目数
        const DEFAULT_NAME_HEAD = '名称未設定';                    // デフォルトの設定名
        
        /**
@@ -34,7 +31,7 @@ class admin_whatsnewWidgetContainer extends BaseAdminWidgetContainer
                // 親クラスを呼び出す
                parent::__construct();
                
-               // DBオブジェクト作成
+               // DB接続オブジェクト作成
                $this->db = new whatsnewDb();
        }
        /**
@@ -48,7 +45,7 @@ class admin_whatsnewWidgetContainer extends BaseAdminWidgetContainer
         * @return string                                               テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
         */
        function _setTemplate($request, &$param)
-       {
+       {       
                $task = $request->trimValueOf('task');
                if ($task == 'list'){           // 一覧画面
                        return 'admin_list.tmpl.html';
@@ -82,38 +79,31 @@ class admin_whatsnewWidgetContainer extends BaseAdminWidgetContainer
         */
        function createDetail($request)
        {
+               // ページ定義IDとページ定義のレコードシリアル番号を取得
+               $this->startPageDefParam($defSerial, $defConfigId, $this->paramObj);
+               
                $userId         = $this->gEnv->getCurrentUserId();
                $this->langId   = $this->gEnv->getCurrentLanguage();            // 表示言語を取得
+               
                $act = $request->trimValueOf('act');
                $this->serialNo = $request->trimValueOf('serial');              // 選択項目のシリアル番号
-               
-               // ページ定義IDとページ定義のレコードシリアル番号
-               $defConfigId = $this->getPageDefConfigId($request);                             // 定義ID取得
-               $defSerial = $this->getPageDefSerial($request);         // ページ定義のレコードシリアル番号
-               $value = $request->trimValueOf('defconfig');            // ページ定義の定義ID
-               if (!empty($value)) $defConfigId = $value;
-               $value = $request->trimValueOf('defserial');            // ページ定義のレコードシリアル番号
-               if (!empty($value)) $defSerial = $value;
-               
-               $name = $request->trimValueOf('item_name');
-               $html = $request->valueOf('item_html');         // ヘッダコンテンツ
                $this->configId = $request->trimValueOf('item_id');             // 定義ID
                if (empty($this->configId)) $this->configId = $defConfigId;             // 呼び出しウィンドウから引き継いだ定義ID
                
-               // パラメータオブジェクトを取得
-               $this->paramObj = $this->getWidgetParamObj();
+               // 入力値を取得
+               $name   = $request->trimValueOf('item_name');                   // 定義名
+               $itemCount      = $request->valueOf('item_count');                      // 表示項目数
+               $useRss = ($request->trimValueOf('item_use_rss') == 'on') ? 1 : 0;              // RSS配信を行うかどうか
                
-               if (empty($act)){// 初期起動時
-                       $name = '';
-                       $this->configId = $defConfigId;         // 呼び出しウィンドウから引き継いだ定義ID
-                       $html = '';             // コンテンツ
-               } else if ($act == 'add'){// 新規追加
+               $replaceNew = false;            // データを再取得するかどうか
+               if ($act == 'add'){// 新規追加
                        // 入力チェック
                        $this->checkInput($name, '名前');
-
+                       $this->checkNumeric($itemCount, '表示項目数');
+                       
                        // 設定名の重複チェック
                        for ($i = 0; $i < count($this->paramObj); $i++){
-                               $targetObj = $this->paramObj[$i];
+                               $targetObj = $this->paramObj[$i]->object;
                                if ($name == $targetObj->name){         // 定義名
                                        $this->setUserErrorMsg('名前が重複しています');
                                        break;
@@ -122,152 +112,98 @@ class admin_whatsnewWidgetContainer extends BaseAdminWidgetContainer
                        
                        // エラーなしの場合は、データを登録
                        if ($this->getMsgCount() == 0){
-                               // コンテンツ登録
-                               $contentId = 0;// コンテンツID新規追加
-                               $default = 0;
-                               $key = '';
-                               $ret = $this->db->updateContentItem(self::CONTENT_TYPE, $contentId, $this->langId, $name, $html, 1/*コンテンツ表示*/, $default, $key, $userId, $newContentId, $newSerial);
-                               if ($ret) $contentId = $newContentId;// コンテンツID更新
-                               
-                               // 最大の定義ID取得
-                               $newConfigId = 1;
-                               if (count($this->paramObj) > 0){
-                                       $targetObj = $this->paramObj[count($this->paramObj) -1];
-                                       $newConfigId = $targetObj->id + 1;
-                               }
                                // 追加オブジェクト作成
                                $newObj = new stdClass;
                                $newObj->name   = $name;// 表示名
-                               $newObj->id     = $newConfigId;// 定義ID
-                               $newObj->contentId = $contentId;                // コンテンツID
-                               $this->paramObj[] = $newObj;
-                       
-                               // ウィジェットパラメータオブジェクト更新
-                               $ret = $this->updateWidgetParamObj($this->paramObj);
+                               $newObj->itemCount      = $itemCount;
+                               $newObj->useRss = $useRss;
                                
-                               // 画面定義更新
-                               if ($ret && !empty($defSerial)){
-                                       $ret = $this->_db->updateWidgetConfigId($this->gEnv->getCurrentWidgetId(), $defSerial, $newConfigId, $name);
-                               }
+                               $ret = $this->addPageDefParam($defSerial, $defConfigId, $this->paramObj, $newObj);
                                if ($ret){
                                        $this->setGuidanceMsg('データを追加しました');
                                        
-                                       if (!empty($defSerial)) $defConfigId = $newConfigId;            // 定義定義IDを更新
-                                       $this->configId = $newConfigId;         // 定義定義IDを更新
+                                       $this->configId = $defConfigId;         // 定義定義IDを更新
+                                       $replaceNew = true;                     // データ再取得
                                } else {
                                        $this->setAppErrorMsg('データ追加に失敗しました');
                                }
                                $this->gPage->updateParentWindow($defSerial);// 親ウィンドウを更新
                        }
-               } else if ($act == 'update'){           // 項目更新の場合
-                       // エラーなしの場合は、データを更新
-                       if ($this->getMsgCount() == 0){
-                               // コンテンツIDを取得
-                               $contentId = 0;
-                               for ($i = 0; $i < count($this->paramObj); $i++){
-                                       $targetObj = $this->paramObj[$i];
-                                       $id = $targetObj->id;// 定義ID
-                                       $name = $targetObj->name;// 定義名
-                                       if ($id == $this->configId){
-                                               $contentId = $targetObj->contentId;
-                                               break;
-                                       }
+               } else if ($act == 'update'){           // 設定更新のとき
+                       // 入力値のエラーチェック
+                       $this->checkNumeric($itemCount, '表示項目数');
+                       
+                       if ($this->getMsgCount() == 0){                 // エラーのないとき
+                               // 現在の設定値を取得
+                               $ret = $this->getPageDefParam($defSerial, $defConfigId, $this->paramObj, $this->configId, $targetObj);
+                               if ($ret){
+                                       // ウィジェットオブジェクト更新
+                                       $targetObj->itemCount   = $itemCount;
+                                       $targetObj->useRss      = $useRss;
                                }
-                               // ウィジェットパラメータオブジェクトを更新
-                               $ret = $this->updateWidgetParamObj($this->paramObj);
                                
-                               // コンテンツを更新
-                               $default = 0;
-                               $key = '';
-                               $ret = $this->db->updateContentItem(self::CONTENT_TYPE, $contentId, $this->langId, $name, $html, 1/*コンテンツ表示*/, $default, $key, $userId, $newContentId, $newSerial);
-                               
-                               if (empty($defConfigId) && !empty($defSerial)){         // 画面定義の定義IDが設定されていないときは設定
-                                       // 画面定義更新
-                                       if ($ret) $ret = $this->_db->updateWidgetConfigId($this->gEnv->getCurrentWidgetId(), $defSerial, $this->configId, $name);
-                               }
+                               // 設定値を更新
+                               if ($ret) $ret = $this->updatePageDefParam($defSerial, $defConfigId, $this->paramObj, $this->configId, $targetObj);
                                if ($ret){
-                                       $this->setGuidanceMsg('データを更新しました');
-                                       
-                                       if (empty($defConfigId) && !empty($defSerial)){         // 画面定義の定義IDが設定されていないときは設定
-                                               $defConfigId = $this->configId;         // 定義定義IDを更新
-                                       }
+                                       $this->setMsg(self::MSG_GUIDANCE, 'データを更新しました');
+                                       $replaceNew = true;                     // データ再取得
                                } else {
-                                       $this->setAppErrorMsg('データ更新に失敗しました');
+                                       $this->setMsg(self::MSG_APP_ERR, 'データ更新に失敗しました');
                                }
                                $this->gPage->updateParentWindow($defSerial);// 親ウィンドウを更新
                        }
                } else if ($act == 'select'){   // 定義IDを変更
+                       $replaceNew = true;                     // データ再取得
+               } else {        // 初期起動時、または上記以外の場合
+                       // デフォルト値設定
+                       $this->configId = $defConfigId;         // 呼び出しウィンドウから引き継いだ定義ID
+                       $replaceNew = true;                     // データ再取得
                }
-
-               // お知らせ選択メニュー作成
-               $this->createNewsListMenu();
-
+               // 表示用データを取得
                if (empty($this->configId)){            // 新規登録の場合
                        $this->tmpl->setAttribute('item_name_visible', 'visibility', 'visible');// 名前入力フィールド表示
-                       $name = $this->createDefaultName();                     // デフォルト登録項目名
-                       $html = '';
+                       if ($replaceNew){               // データ再取得時
+                               $name = $this->createDefaultName();                     // デフォルト登録項目名
+                               $itemCount = self::DEFAULT_ITEM_COUNT;  // 表示項目数
+                               $useRss = 1;                                                    // RSS配信を行うかどうか
+                       }
                        $this->serialNo = 0;
                } else {
-                       // 定義からウィジェットパラメータを検索して、定義データを取得
-                       for ($i = 0; $i < count($this->paramObj); $i++){
-                               $targetObj = $this->paramObj[$i];
-                               $id = $targetObj->id;// 定義ID
-                               if ($id == $this->configId) break;
-                       }
-                       if ($i < count($this->paramObj)){               // 該当項目があるとき
-                               // コンテンツを取得
-                               $contentId = $targetObj->contentId;
-                               $ret = $this->db->getContentByContentId(self::CONTENT_TYPE, $contentId, $this->langId, $row);
+                       if ($replaceNew){// データ再取得時
+                               $ret = $this->getPageDefParam($defSerial, $defConfigId, $this->paramObj, $this->configId, $targetObj);
                                if ($ret){
-                                       $html = str_replace(M3_TAG_START . M3_TAG_MACRO_ROOT_URL . M3_TAG_END, $this->getUrl($this->gEnv->getRootUrl()), $row['cn_html']);// アプリケーションルートを変換
-                                       $this->serialNo = $row['cn_serial'];
-                                       
-                                       $name = $targetObj->name;// 名前
-                                       
-                                       // 新規作成でないときは、メニューを変更不可にする
-                                       if (!empty($defConfigId) && !empty($defSerial)) $this->tmpl->addVar("_widget", "id_disabled", 'disabled');
+                                       $name           = $targetObj->name;     // 名前
+                                       $itemCount      = $targetObj->itemCount;
+                                       $useRss         = $targetObj->useRss;// RSS配信を行うかどうか
+                                       if (!isset($useRss)) $useRss = 1;
                                }
                        }
+                       $this->serialNo = $this->configId;
+                               
+                       // 新規作成でないときは、メニューを変更不可にする(画面作成から呼ばれている場合のみ)
+                       if (!empty($defConfigId) && !empty($defSerial)) $this->tmpl->addVar("_widget", "id_disabled", 'disabled');
                }
+
+               // 設定項目選択メニュー作成
+               $this->createItemMenu();
                
-               // ### 入力値を再設定 ###
-               $this->tmpl->addVar("item_name_visible", "name", $name);                // 名前
-               $this->tmpl->addVar("_widget", "content", $html);               // コンテンツ
-               
+               // 画面にデータを埋め込む
+               if (!empty($this->configId)) $this->tmpl->addVar("_widget", "id", $this->configId);             // 定義ID
+               $this->tmpl->addVar("item_name_visible", "name",        $name);
                $this->tmpl->addVar("_widget", "serial", $this->serialNo);// 選択中のシリアル番号、IDを設定
-
-               // 画面定義用の情報を戻す
-               $this->tmpl->addVar("_widget", "def_serial", $defSerial);       // ページ定義のレコードシリアル番号
-               $this->tmpl->addVar("_widget", "def_config", $defConfigId);     // ページ定義の定義ID
+               
+               $this->tmpl->addVar("_widget", "item_count",    $itemCount);
+               $this->tmpl->addVar("_widget", "use_rss",       $this->convertToCheckedString($useRss));// RSS配信を行うかどうか
                
                // ボタンの表示制御
                if (empty($this->serialNo)){            // 新規追加項目を選択しているとき
                        $this->tmpl->setAttribute('add_button', 'visibility', 'visible');// 「新規追加」ボタン
                } else {
-                       $this->tmpl->setAttribute('del_button', 'visibility', 'visible');// 「削除」ボタン
-               }
-       }
-       /**
-        * お知らせ選択用メニュー
-        *
-        * @return なし                                               
-        */
-       function createNewsListMenu()
-       {
-               for ($i = 0; $i < count($this->paramObj); $i++){
-                       $targetObj = $this->paramObj[$i];
-                       $id = $targetObj->id;// 定義ID
-                       $name = $targetObj->name;// 定義名
-                       $selected = '';
-                       if ($this->configId == $id) $selected = 'selected';
-                       $row = array(
-                               'name' => $name,                // 名前
-                               'value' => $id,         // 定義ID
-                               'selected' => $selected // 選択中の項目かどうか
-                       );
-                       $this->tmpl->addVars('news_list', $row);
-                       $this->tmpl->parseTemplate('news_list', 'a');
+                       $this->tmpl->setAttribute('update_button', 'visibility', 'visible');// 「更新」ボタン
                }
+               
+               // ページ定義IDとページ定義のレコードシリアル番号を更新
+               $this->endPageDefParam($defSerial, $defConfigId, $this->paramObj);
        }
        /**
         * 一覧画面作成
@@ -277,21 +213,13 @@ class admin_whatsnewWidgetContainer extends BaseAdminWidgetContainer
         */
        function createList($request)
        {
+               // ページ定義IDとページ定義のレコードシリアル番号を取得
+               $this->startPageDefParam($defSerial, $defConfigId, $this->paramObj);
+               
                $userId         = $this->gEnv->getCurrentUserId();
                $langId = $this->gEnv->getCurrentLanguage();            // 表示言語を取得
                $act = $request->trimValueOf('act');
                
-               // ページ定義IDとページ定義のレコードシリアル番号
-               $defConfigId = $this->getPageDefConfigId($request);                             // 定義ID取得
-               $defSerial = $this->getPageDefSerial($request);         // ページ定義のレコードシリアル番号
-               $value = $request->trimValueOf('defconfig');            // ページ定義の定義ID
-               if (!empty($value)) $defConfigId = $value;
-               $value = $request->trimValueOf('defserial');            // ページ定義のレコードシリアル番号
-               if (!empty($value)) $defSerial = $value;
-
-               // パラメータオブジェクトを取得
-               $this->paramObj = $this->getWidgetParamObj();
-               
                if ($act == 'delete'){          // メニュー項目の削除
                        $listedItem = explode(',', $request->trimValueOf('seriallist'));
                        $delItems = array();
@@ -305,56 +233,45 @@ class admin_whatsnewWidgetContainer extends BaseAdminWidgetContainer
                                }
                        }
                        if (count($delItems) > 0){
-                               // 更新オブジェクト作成
-                               $newParamObj = array();
-
-                               for ($i = 0; $i < count($this->paramObj); $i++){
-                                       $targetObj = $this->paramObj[$i];
-                                       $id = $targetObj->id;// 定義ID
-                                       if (!in_array($id, $delItems)){         // 削除対象でないときは追加
-                                               $newParamObj[] = $targetObj;
-                                       }
-                               }
-                               
-                               // ウィジェットパラメータオブジェクト更新
-                               $ret = $this->updateWidgetParamObj($newParamObj);
+                               $ret = $this->delPageDefParam($defSerial, $defConfigId, $this->paramObj, $delItems);
                                if ($ret){              // データ削除成功のとき
                                        $this->setGuidanceMsg('データを削除しました');
-                                       $this->paramObj = $newParamObj;
                                } else {
                                        $this->setAppErrorMsg('データ削除に失敗しました');
                                }
                        }
                }
-               // お知らせ選択リスト作成
-               $this->createNewsList();
+               // 定義一覧作成
+               $this->createItemList();
                
                $this->tmpl->addVar("_widget", "serial_list", implode($this->serialArray, ','));// 表示項目のシリアル番号を設定
                
-               // 画面定義用の情報を戻す
-               $this->tmpl->addVar("_widget", "def_serial", $defSerial);       // ページ定義のレコードシリアル番号
-               $this->tmpl->addVar("_widget", "def_config", $defConfigId);     // ページ定義の定義ID
+               // ページ定義IDとページ定義のレコードシリアル番号を更新
+               $this->endPageDefParam($defSerial, $defConfigId, $this->paramObj);
        }
        /**
-        * お知らせ一覧用リスト
+        * 定義一覧作成
         *
         * @return なし                                               
         */
-       function createNewsList()
+       function createItemList()
        {
                for ($i = 0; $i < count($this->paramObj); $i++){
-                       $targetObj = $this->paramObj[$i];
-                       $id = $targetObj->id;// 定義ID
+                       $id                     = $this->paramObj[$i]->id;// 定義ID
+                       $targetObj      = $this->paramObj[$i]->object;
                        $name = $targetObj->name;// 定義名
-                       
+               
+                       // 使用数
                        $defCount = 0;
                        if (!empty($id)){
                                $defCount = $this->_db->getPageDefCount($this->gEnv->getCurrentWidgetId(), $id);
                        }
                        $operationDisagled = '';
                        if ($defCount > 0) $operationDisagled = 'disabled';
+                       
                        $row = array(
                                'index' => $i,
+                               'id' => $id,
                                'ope_disabled' => $operationDisagled,                   // 選択可能かどうか
                                'name' => $this->convertToDispString($name),            // 名前
                                'def_count' => $defCount                                                        // 使用数
@@ -367,6 +284,29 @@ class admin_whatsnewWidgetContainer extends BaseAdminWidgetContainer
                }
        }
        /**
+        * 選択用メニューを作成
+        *
+        * @return なし                                               
+        */
+       function createItemMenu()
+       {
+               for ($i = 0; $i < count($this->paramObj); $i++){
+                       $id = $this->paramObj[$i]->id;// 定義ID
+                       $targetObj = $this->paramObj[$i]->object;
+                       $name = $targetObj->name;// 定義名
+                       $selected = '';
+                       if ($this->configId == $id) $selected = 'selected';
+
+                       $row = array(
+                               'name' => $name,                // 名前
+                               'value' => $id,         // 定義ID
+                               'selected' => $selected // 選択中の項目かどうか
+                       );
+                       $this->tmpl->addVars('title_list', $row);
+                       $this->tmpl->parseTemplate('title_list', 'a');
+               }
+       }
+       /**
         * デフォルトの名前を取得
         *
         * @return string       デフォルト名                                              
@@ -378,7 +318,7 @@ class admin_whatsnewWidgetContainer extends BaseAdminWidgetContainer
                        $name = self::DEFAULT_NAME_HEAD . $j;
                        // 設定名の重複チェック
                        for ($i = 0; $i < count($this->paramObj); $i++){
-                               $targetObj = $this->paramObj[$i];
+                               $targetObj = $this->paramObj[$i]->object;
                                if ($name == $targetObj->name){         // 定義名
                                        break;
                                }
diff --git a/widgets/whatsnew/include/container/rss_whatsnewWidgetContainer.php b/widgets/whatsnew/include/container/rss_whatsnewWidgetContainer.php
new file mode 100644 (file)
index 0000000..ef64c29
--- /dev/null
@@ -0,0 +1,177 @@
+<?php
+/**
+ * index.php用コンテナクラス
+ *
+ * PHP versions 5
+ *
+ * LICENSE: This source file is licensed under the terms of the GNU General Public License.
+ *
+ * @package    Magic3 Framework
+ * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
+ * @copyright  Copyright 2006-2014 Magic3 Project.
+ * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
+ * @version    SVN: $Id$
+ * @link       http://www.magic3.org
+ */
+require_once($gEnvManager->getContainerPath() . '/baseRssContainer.php');
+require_once($gEnvManager->getCurrentWidgetDbPath() . '/whatsnewDb.php');
+
+class rss_whatsnewWidgetContainer extends BaseRssContainer
+{
+       private $db;
+       private $isExistsList;                          // リスト項目が存在するかどうか
+       private $rssChannel;                            // RSSチャンネル部出力データ
+       private $rssSeqUrl = array();                                   // 項目の並び
+       private $defaultUrl;    // システムのデフォルトURL
+       const DEFAULT_CONFIG_ID = 0;
+       const DEFAULT_ITEM_COUNT = 10;          // デフォルトの表示項目数
+       const DEFAULT_TITLE = 'ブログカテゴリ(%s)の最新記事';               // デフォルトのウィジェットタイトル名
+       const DEFAULT_CATEGORY_NAME = 'カテゴリ未選択';          // デフォルトのカテゴリ名
+       const DEFAULT_DESC = 'ブログカテゴリ(%s)の最新の記事が取得できます。';
+       
+       /**
+        * コンストラクタ
+        */
+       function __construct()
+       {
+               // 親クラスを呼び出す
+               parent::__construct();
+               
+               // DBオブジェクト作成
+               $this->db = new whatsnewDb();
+       }
+       /**
+        * テンプレートファイルを設定
+        *
+        * _assign()でデータを埋め込むテンプレートファイルのファイル名を返す。
+        * 読み込むディレクトリは、「自ウィジェットディレクトリ/include/template」に固定。
+        *
+        * @param RequestManager $request               HTTPリクエスト処理クラス
+        * @param object         $param                 任意使用パラメータ。そのまま_assign()に渡る
+        * @return string                                               テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
+        */
+       function _setTemplate($request, &$param)
+       {
+               return 'rss_index.tmpl.html';
+       }
+       /**
+        * テンプレートにデータ埋め込む
+        *
+        * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
+        *
+        * @param RequestManager $request               HTTPリクエスト処理クラス
+        * @param object         $param                 任意使用パラメータ。_setTemplate()と共有。
+        * @param                                                               なし
+        */
+       function _assign($request, &$param)
+       {
+               $now = date("Y/m/d H:i:s");     // 現在日時
+               $langId = $this->gEnv->getCurrentLanguage();
+               
+               // 定義ID取得
+               $configId = $this->gEnv->getCurrentWidgetConfigId();
+               if (empty($configId)) $configId = self::DEFAULT_CONFIG_ID;
+               
+               // 初期値設定
+               $itemCount = self::DEFAULT_ITEM_COUNT;  // 表示項目数
+               $useRss = 1;                                                    // RSS配信を行うかどうか
+               
+               // パラメータオブジェクトを取得
+               $targetObj = $this->getWidgetParamObjByConfigId($configId);
+               if (!empty($targetObj)){                // 定義データが取得できたとき
+                       $itemCount      = $targetObj->itemCount;
+                       $useRss         = $targetObj->useRss;// RSS配信を行うかどうか
+                       if (!isset($useRss)) $useRss = 1;
+               }
+               // カテゴリIDはURLから取得
+               $categoryId = $request->trimValueOf(M3_REQUEST_PARAM_CATEGORY_ID);
+               if (empty($categoryId)) $categoryId = 0;
+               
+/*             // 設定値を取得
+               $categoryId = 0;// カテゴリID
+               $itemCount = self::DEFAULT_ITEM_COUNT;  // 表示項目数
+               $useRss = 1;                                                    // RSS配信を行うかどうか
+               $paramObj = $this->getWidgetParamObj();
+               if (!empty($paramObj)){
+                       $categoryId = $paramObj->categoryId;// カテゴリID
+                       $itemCount      = $paramObj->itemCount;
+                       $useRss         = $paramObj->useRss;// RSS配信を行うかどうか
+                       if (!isset($useRss)) $useRss = 1;
+               }*/
+               
+               // RSS配信を行わないときは終了
+               //if (empty($useRss)) $this->cancelParse();             // 出力しない
+               if (empty($useRss)){
+                       // ページ作成処理中断
+                       $this->gPage->abortPage();
+                       
+                       // システム強制終了
+                       $this->gPage->exitSystem();
+               }
+               // カテゴリ名を取得
+               $categoryName = self::DEFAULT_CATEGORY_NAME;
+               $ret = $this->db->getCategoryByCategoryId($categoryId, $langId, $row);
+               if ($ret) $categoryName = $row['bc_name'];
+               
+               // 一覧を作成
+               $this->defaultUrl = $this->gEnv->getDefaultUrl();
+               $this->db->getEntryItems($itemCount, $langId, $categoryId, $now, array($this, 'itemLoop'));
+                               
+               // 画面にデータを埋め込む
+               if ($this->isExistsList) $this->tmpl->setAttribute('itemlist', 'visibility', 'visible');
+               
+               // RSSチャンネル部出力データ作成
+               $linkUrl = $this->getUrl($this->gPage->createRssCmdUrl($this->gEnv->getCurrentWidgetId()));
+               $this->rssChannel = array(      'title' => sprintf(self::DEFAULT_TITLE, $categoryName),         // タイトル
+                                                                       'link' => $linkUrl,                                     // RSS配信用URL
+                                                                       'description' => sprintf(self::DEFAULT_DESC, $categoryName),// 説明
+                                                                       'seq' => $this->rssSeqUrl);                     // 項目の並び
+       }
+       /**
+        * RSSのチャンネル部出力
+        *
+        * _assign()よりも後に実行される。
+        *
+        * @param RequestManager $request               HTTPリクエスト処理クラス
+        * @param object         $param                 任意使用パラメータ
+        * @return array                                                設定データ
+        */
+       function _setRssChannel($request, &$param)
+       {
+               return $this->rssChannel;
+       }
+       /**
+        * 取得したメニュー項目をテンプレートに設定する
+        *
+        * @param int           $index                  行番号
+        * @param array         $fetchedRow             取得行
+        * @param object        $param                  任意使用パラメータ
+        * @return bool                                         trueを返すとループ続行。falseを返すとその時点で終了。
+        */
+       function itemLoop($index, $fetchedRow)
+       {
+               $totalViewCount = $fetchedRow['total'];
+               $name = $fetchedRow['be_name'];
+
+               // 記事へのリンク
+               $linkUrl = $this->getUrl($this->defaultUrl . '?'. M3_REQUEST_PARAM_BLOG_ENTRY_ID . '=' . $fetchedRow['be_id'], true);
+               
+               if (!empty($name)){
+                       $row = array(
+                               'total' => $totalViewCount,             // 閲覧数
+                               'link_url' => $this->convertUrlToHtmlEntity($linkUrl),          // リンク
+                               'name' => $this->convertToDispString($name),                    // タイトル
+                               'date' => getW3CDate($fetchedRow['be_regist_dt'])               // 投稿日時
+                       );
+                       $this->tmpl->addVars('itemlist', $row);
+                       $this->tmpl->parseTemplate('itemlist', 'a');
+               
+                       // RSS用
+                       $this->rssSeqUrl[] = $linkUrl;                                  // 項目の並び
+                       
+                       $this->isExistsList = true;             // リスト項目が存在するかどうか
+               }
+               return true;
+       }
+}
+?>
index f924293..6c0e2b3 100644 (file)
  * @version    SVN: $Id$
  * @link       http://www.magic3.org
  */
-require_once($gEnvManager->getContainerPath() . '/baseWidgetContainer.php');
-require_once($gEnvManager->getCurrentWidgetDbPath() . '/whatsnewDb.php');
+require_once($gEnvManager->getContainerPath()          . '/baseWidgetContainer.php');
+require_once($gEnvManager->getCurrentWidgetDbPath()    . '/whatsnewDb.php');
 
 class whatsnewWidgetContainer extends BaseWidgetContainer
 {
-       private $db;                    // DB接続オブジェクト
-       private $langId;                // 現在の言語
+       private $db;    // DB接続オブジェクト
+       private $isEntry;       // 記事の投稿があるかどうか
+       private $defaultUrl;    // システムのデフォルトURL
+       private $headRssFile;                           // RSS情報
+       private $categoryName;          // カテゴリ名
        const DEFAULT_CONFIG_ID = 0;
-       const CONTENT_TYPE = 'news';                    // コンテンツタイプ
+       const DEFAULT_ITEM_COUNT = 20;          // デフォルトの表示項目数
+       const MAX_TITLE_LENGTH = 20;                    // タイトルの最大文字列長
+       const DEFAULT_TITLE = 'ブログカテゴリ(%s)の最新記事';               // デフォルトのウィジェットタイトル名
+       const DEFAULT_CATEGORY_NAME = 'カテゴリ未選択';          // デフォルトのカテゴリ名
+       const RSS_ICON_FILE = '/images/system/rss14.png';               // RSSリンク用アイコン
                
        /**
         * コンストラクタ
@@ -31,7 +38,7 @@ class whatsnewWidgetContainer extends BaseWidgetContainer
                // 親クラスを呼び出す
                parent::__construct();
                
-               // DBオブジェクト作成
+               // DB接続オブジェクト作成
                $this->db = new whatsnewDb();
        }
        /**
@@ -45,7 +52,7 @@ class whatsnewWidgetContainer extends BaseWidgetContainer
         * @return string                                               テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
         */
        function _setTemplate($request, &$param)
-       {
+       {       
                return 'index.tmpl.html';
        }
        /**
@@ -59,36 +66,124 @@ class whatsnewWidgetContainer extends BaseWidgetContainer
         */
        function _assign($request, &$param)
        {
-               $this->langId = $this->gEnv->getCurrentLanguage();
+               $now = date("Y/m/d H:i:s");     // 現在日時
+               $langId = $this->gEnv->getCurrentLanguage();            // 表示言語を取得
                
                // 定義ID取得
                $configId = $this->gEnv->getCurrentWidgetConfigId();
                if (empty($configId)) $configId = self::DEFAULT_CONFIG_ID;
                
+               // 初期値設定
+               $categoryId = 0;// カテゴリID
+               $itemCount = self::DEFAULT_ITEM_COUNT;  // 表示項目数
+               $useRss = 1;                                                    // RSS配信を行うかどうか
+               
                // パラメータオブジェクトを取得
+               $targetObj = $this->getWidgetParamObjByConfigId($configId);
+               if (!empty($targetObj)){                // 定義データが取得できたとき
+                       $categoryId = $targetObj->categoryId;           // カテゴリID
+                       $itemCount      = $targetObj->itemCount;
+                       $useRss         = $targetObj->useRss;// RSS配信を行うかどうか
+                       if (!isset($useRss)) $useRss = 1;
+               }
+               /*
                $paramObj = $this->getWidgetParamObj();
-               
-               // コンテンツIDを取得
-               $contentId = 0;
-               $name = '';
-               for ($i = 0; $i < count($paramObj); $i++){
-                       $targetObj = $paramObj[$i];
-                       $id = $targetObj->id;// 定義ID
-                       if ($id == $configId){
-                               $contentId = $targetObj->contentId;
-                               $name = $targetObj->name;// 定義名
-                               break;
-                       }
+               if (!empty($paramObj)){
+                       $categoryId = $paramObj->categoryId;// カテゴリID
+                       $itemCount      = $paramObj->itemCount;
+                       $useRss         = $paramObj->useRss;// RSS配信を行うかどうか
+                       if (!isset($useRss)) $useRss = 1;
+               }*/
+               // カテゴリ名を取得
+               $this->categoryName = self::DEFAULT_CATEGORY_NAME;
+               $ret = $this->db->getCategoryByCategoryId($categoryId, $langId, $row);
+               if ($ret) $this->categoryName = $row['bc_name'];
+                               
+               // 新規ブログタイトルを取得
+               $this->defaultUrl = $this->gEnv->getDefaultUrl();
+               $this->db->getEntryItems($itemCount, $this->gEnv->getCurrentLanguage(), $categoryId, $now, array($this, 'itemLoop'));
+
+               if (!$this->isEntry){   // 記事の投稿がないときはメッセージを出力
+                       $this->tmpl->addVar("_widget", "message", '投稿記事はありません');
                }
                
-               // コンテンツを取得
-               $ret = $this->db->getContentByContentId(self::CONTENT_TYPE, $contentId, $this->langId, $row);
-               if ($ret){
-                       $html = str_replace(M3_TAG_START . M3_TAG_MACRO_ROOT_URL . M3_TAG_END, $this->getUrl($this->gEnv->getRootUrl()), $row['cn_html']);// アプリケーションルートを変換
+               // RSSの設定
+               if (empty($useRss)){
+                       $this->tmpl->addVar("_widget", "rss_link", '');
+                       $this->headRssFile = array();
+               } else {
+                       // RSS用リンク作成
+                       $iconTitle = sprintf(self::DEFAULT_TITLE, $this->categoryName);
+                       $iconUrl = $this->gEnv->getRootUrl() . self::RSS_ICON_FILE;
+                       $rssLink = '<img src="' . $this->getUrl($iconUrl) . '" border="0" alt="' . $iconTitle . '" title="' . $iconTitle . '" />';
+                       $linkUrl = $this->gPage->createRssCmdUrl($this->gEnv->getCurrentWidgetId(), M3_REQUEST_PARAM_CATEGORY_ID . '=' . $categoryId);
+                       $rssLink = '<a href="' . convertUrlToHtmlEntity($this->getUrl($linkUrl)) . '">' . $rssLink . '</a>';
+                       $rssLink = '<div align="right">' . $rssLink . '</div>';         // 右寄せ
+                       $this->tmpl->addVar("_widget", "rss_link", $rssLink);
+               
+                       // RSS情報を設定
+                       $this->headRssFile = array(
+                                                                       'title' => $iconTitle,          // タイトル
+                                                                       'href' => $this->getUrl($linkUrl)               // リンク先URL
+                                                               );                              // RSS情報
+               }
+       }
+       /**
+        * ウィジェットのタイトルを設定
+        *
+        * @param RequestManager $request               HTTPリクエスト処理クラス
+        * @param object         $param                 任意使用パラメータ。そのまま_assign()に渡る
+        * @return string                                               ウィジェットのタイトル名
+        */
+       function _setTitle($request, &$param)
+       {
+               return $this->categoryName;
+       }
+       /**
+        * RSS情報をHTMLヘッダ部に設定
+        *
+        * RSS情報をHTMLのheadタグ内に追加出力する。
+        * _assign()よりも後に実行される。
+        *
+        * @param RequestManager $request               HTTPリクエスト処理クラス
+        * @param object         $param                 任意使用パラメータ。
+        * @return array                                                RSS情報データ。連想配列で「title」(タイトル)「href」(RSS配信用URL)を設定。出力しない場合は空配列を設定。
+        */
+       function _addRssFileToHead($request, &$param)
+       {
+               return $this->headRssFile;
+       }
+       /**
+        * 取得したデータをテンプレートに設定する
+        *
+        * @param int $index                    行番号(0~)
+        * @param array $fetchedRow             フェッチ取得した行
+        * @param object $param                 未使用
+        * @return bool                                 true=処理続行の場合、false=処理終了の場合
+        */
+       function itemLoop($index, $fetchedRow, $param)
+       {
+               // タイトルを設定
+               $title = $fetchedRow['be_name'];
+               // タイトルの長さは制限
+               if (function_exists('mb_substr')){
+                       $title = mb_substr($title, 0, self::MAX_TITLE_LENGTH);
+               } else {
+                       $title = substr($title, 0, self::MAX_TITLE_LENGTH);
                }
                
-               // コンテンツを設定
-               $this->tmpl->addVar("_widget", "content", $html);
+               // 記事へのリンク
+               $url = $this->defaultUrl . '?'. M3_REQUEST_PARAM_BLOG_ENTRY_ID . '=' . $fetchedRow['be_id'];
+
+               $row = array(
+                       'link_url' => $this->convertUrlToHtmlEntity($this->getUrl($url, true/*リンク用*/)),         // リンク
+                       'name' => $this->convertToDispString($title)                    // タイトル
+               );
+               $this->tmpl->addVars('itemlist', $row);
+               $this->tmpl->parseTemplate('itemlist', 'a');
+               
+               $this->isEntry = true;  // 記事の投稿があるかどうか
+               return true;
        }
 }
 ?>
index afbbc67..1b8dcb1 100644 (file)
@@ -42,10 +42,6 @@ function listItem(){
        document.main.submit();
        return true;
 }
-$(function(){
-       // WYSIWYGエディター作成
-       m3SetWysiwygEditor('item_html', 300);
-});
 //]]>
 </script>
 <div class="m3config_container">
@@ -54,23 +50,21 @@ $(function(){
 <input type="hidden" name="task" />
 <input type="hidden" name="act" />
 <input type="hidden" name="serial" value="{SERIAL}" />
-<input type="hidden" name="defserial" value="{DEF_SERIAL}" />
-<input type="hidden" name="defconfig" value="{DEF_CONFIG}" />
-
-<table width="90%">
-<tr><td><label>お知らせ項目</label></td>
+<!-- m3:PostParam -->
+<table style="margin:0 auto;">
+<tr><td><label>新着情報-簡易</label></td>
 <td align="right"><input type="button" class="button" onclick="listItem();" value="一覧" />
 </td></tr>
 <tr><td colspan="2">
 
-<table class="simple-table" style="margin: 0 auto;width:950px;">
+<table class="simple-table" style="margin:0 auto;width:950px;">
     <tbody>
         <tr>
            <td class="table-headside" width="150">名前</td>
            <td>
            <select name="item_id" onchange="selectItem();" {ID_DISABLED}>
                <option value="0">-- 新規登録 --</option>
-               <patTemplate:tmpl name="news_list">
+               <patTemplate:tmpl name="title_list">
                <option value="{VALUE}" {SELECTED}>{NAME}</option>
                </patTemplate:tmpl>
            </select>
@@ -79,15 +73,18 @@ $(function(){
            </patTemplate:tmpl>
            </td>
        </tr>
-        <tr class="even">
-           <td class="table-headside">お知らせ内容</td>
-           <td>
-           <textarea name="item_html">{CONTENT}</textarea>
+    <tr class="even">
+           <td class="table-headside">表示項目数</td>
+           <td><input type="text" name="item_count" value="{ITEM_COUNT}" size="3" maxlength="3" onkeypress="return m3_numericKey(event,true);" />
            </td>
        </tr>
-       <tr>
+    <tr>
+           <td class="table-headside">RSS配信</td>
+           <td><input type="checkbox" name="item_use_rss" {USE_RSS} /></td>
+       </tr>
+       <tr class="even">
        <td align="right" colspan="2">
-<patTemplate:tmpl name="del_button" visibility="hidden">
+<patTemplate:tmpl name="update_button" visibility="hidden">
                <input type="button" class="button" onclick="updateItem();" value="更新" />
 </patTemplate:tmpl>
 <patTemplate:tmpl name="add_button" visibility="hidden">
index 2c8228c..a437e03 100644 (file)
@@ -1,35 +1,47 @@
+/**
+ * 表示データ作成用テンプレート(patTemplate)
+ *
+ * LICENSE: This source file is licensed under the terms of the GNU General Public License.
+ *
+ * @package    Magic3 Framework
+ * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
+ * @copyright  Copyright 2006-2014 Magic3 Project.
+ * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
+ * @version    SVN: $Id$
+ * @link       http://www.magic3.org
+ */
 <patTemplate:tmpl name="_widget">
 <script type="text/javascript">
-<!--
+//<![CDATA[
 function delItem(){
-    if (document.main.seriallist.value){
-        var items = document.main.seriallist.value.split(",");
-       for (var i = 0; i < items.length; i++){
-           var name = "document.main.item" + i + "_selected";
-           var itemObj = eval(name);
-           // チェックありのときは終了
-           if (itemObj && itemObj.checked) break;
+       if (document.main.seriallist.value){
+               var items = document.main.seriallist.value.split(",");
+               for (var i = 0; i < items.length; i++){
+                       var name = "document.main.item" + i + "_selected";
+                       var itemObj = eval(name);
+                       // チェックありのときは終了
+                       if (itemObj && itemObj.checked) break;
+               }
+               if (i == items.length){                 
+                       window.alert('削除する項目を選択してください');
+               } else {
+                       if (!window.confirm('選択項目を削除しますか?')) return false;
+                       document.main.act.value = 'delete';
+                       document.main.submit();
+               }
        }
-       if (i == items.length){                 
-           window.alert('削除する項目を選択してください');
-       } else {
-            if (!window.confirm('選択項目を削除しますか?')) return false;
-            document.main.act.value = 'delete';
-            document.main.submit();
-       }
-    }
-    return true;
+       return true;
 }
 function cancelItem(){
-    document.main.task.value = '';
-    document.main.submit();
-    return true;
+       document.main.task.value = '';
+       document.main.submit();
+       return true;
 }
 $(function(){
        // スクロールバー付きのテーブルを作成
        m3_tableWithScrollbar('itemlist', -1, 0);
 });
-// -->
+//]]>
 </script>
 <div class="m3config_container">
 <!-- m3:ErrorMessage -->
@@ -38,26 +50,25 @@ $(function(){
 <input type="hidden" name="act" />
 <input type="hidden" name="serial" />
 <input type="hidden" name="seriallist" value="{SERIAL_LIST}" />
-<input type="hidden" name="defserial" value="{DEF_SERIAL}" />
-<input type="hidden" name="defconfig" value="{DEF_CONFIG}" />
-<table width="90%">
+<!-- m3:PostParam -->
+<table style="margin:0 auto;">
 <tr><td>
-<label>お知らせ定義一覧</label>
+<label>新着情報-簡易 定義一覧</label>
 </td><td align="right"><input type="button" class="button" onclick="delItem();" value="削除" /><input type="button" class="button" onclick="cancelItem();" value="戻る" />
 </td></tr>
 <tr><td colspan="2">
-<table id="itemlist" class="simple-table" width="100%">
+<table id="itemlist" class="simple-table" style="margin:0 auto;width:950px;">
     <thead>
-        <tr>
+    <tr>
            <th width="35" align="center">選択</th>
            <th width="80%" align="center">名前</th>
            <th align="center">使用</th>
        </tr>
     </thead>
     <tbody>
-        <patTemplate:tmpl name="itemlist">
-        <tr>
-            <td align="center"><input type="checkbox" name="item{INDEX}_selected" {OPE_DISABLED} /></td>
+    <patTemplate:tmpl name="itemlist">
+    <tr>
+        <td align="center"><input type="checkbox" name="item{INDEX}_selected" {OPE_DISABLED} /></td>
            <td>{NAME}</td>
            <td align="center">{DEF_COUNT}</td>
        </tr>
index 0a69e43..2528ec2 100644 (file)
@@ -1,3 +1,15 @@
+/**
+ * 表示データ作成用テンプレート(patTemplate)
+ *
+ * LICENSE: This source file is licensed under the terms of the GNU General Public License.
+ *
+ * @package    Magic3 Framework
+ * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
+ * @copyright  Copyright 2006-2014 Magic3 Project.
+ * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
+ * @version    SVN: $Id$
+ * @link       http://www.magic3.org
+ */
 <patTemplate:tmpl name="_widget">
 {CONTENT}
 </patTemplate:tmpl>
diff --git a/widgets/whatsnew/include/template/rss_index.tmpl.html b/widgets/whatsnew/include/template/rss_index.tmpl.html
new file mode 100644 (file)
index 0000000..97afc35
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * RSS作成用テンプレート(patTemplate)
+ *
+ * LICENSE: This source file is licensed under the terms of the GNU General Public License.
+ *
+ * @package    Magic3 Framework
+ * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
+ * @copyright  Copyright 2006-2014 Magic3 Project.
+ * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
+ * @version    SVN: $Id$
+ * @link       http://www.magic3.org
+ */
+<patTemplate:tmpl name="_widget">
+<patTemplate:tmpl name="itemlist">
+<item rdf:about="{LINK_URL}">
+<title>{NAME}</title>
+<link>{LINK_URL}</link>
+<dc:date>{DATE}</dc:date>
+</item>
+</patTemplate:tmpl>
+</patTemplate:tmpl>