Changeset 933
- Timestamp:
- 06/06/10 02:16:31 (20 months ago)
- Location:
- trunk/plugins/page
- Files:
-
- 9 added
- 11 modified
-
classes/actions/ActionPage.class.php (modified) (7 diffs)
-
classes/modules/page/Page.class.php (modified) (1 diff)
-
classes/modules/page/entity/Page.entity.class.php (modified) (2 diffs)
-
classes/modules/page/mapper/Page.mapper.class.php (modified) (4 diffs)
-
plugin.xml (modified) (1 diff)
-
templates/language/english.php (modified) (2 diffs)
-
templates/language/russian.php (modified) (2 diffs)
-
templates/skin/default/actions/ActionPage/add.tpl (modified) (1 diff)
-
templates/skin/default/actions/ActionPage/admin.tpl (modified) (3 diffs)
-
templates/skin/default/images (added)
-
templates/skin/default/images/delete.gif (added)
-
templates/skin/default/images/down.png (added)
-
templates/skin/default/images/edit.gif (added)
-
templates/skin/default/images/folder_16x16.gif (added)
-
templates/skin/default/images/new_16x16.gif (added)
-
templates/skin/default/images/up.png (added)
-
templates/skin/developer/actions/ActionPage/add.tpl (modified) (1 diff)
-
templates/skin/developer/actions/ActionPage/admin.tpl (modified) (2 diffs)
-
templates/skin/developer/images/down.png (added)
-
templates/skin/developer/images/up.png (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/page/classes/actions/ActionPage.class.php
r881 r933 117 117 $_REQUEST['page_seo_description']=$oPageEdit->getSeoDescription(); 118 118 $_REQUEST['page_active']=$oPageEdit->getActive(); 119 $_REQUEST['page_main']=$oPageEdit->getMain(); 120 $_REQUEST['page_sort']=$oPageEdit->getSort(); 119 121 $_REQUEST['page_id']=$oPageEdit->getId(); 120 122 } else { … … 143 145 } 144 146 /** 147 * Обработка изменения сортировки страницы 148 */ 149 if ($this->GetParam(0)=='sort' and $oPage=$this->PluginPage_Page_GetPageById($this->GetParam(1))) { 150 $this->Security_ValidateSendForm(); 151 $sWay=$this->GetParam(2)=='down' ? 'down' : 'up'; 152 $iSortOld=$oPage->getSort(); 153 if ($oPagePrev=$this->PluginPage_Page_GetNextPageBySort($iSortOld,$oPage->getPid(),$sWay)) { 154 $iSortNew=$oPagePrev->getSort(); 155 $oPagePrev->setSort($iSortOld); 156 $this->PluginPage_Page_UpdatePage($oPagePrev); 157 } else { 158 if ($sWay=='down') { 159 $iSortNew=$iSortOld-1; 160 } else { 161 $iSortNew=$iSortOld+1; 162 } 163 } 164 /** 165 * Меняем значения сортировки местами 166 */ 167 $oPage->setSort($iSortNew); 168 $this->PluginPage_Page_UpdatePage($oPage); 169 } 170 /** 145 171 * Получаем и загружаем список всех страниц 146 172 */ … … 173 199 */ 174 200 $oPageEdit->setActive(getRequest('page_active') ? 1 : 0); 201 $oPageEdit->setMain(getRequest('page_main') ? 1 : 0); 175 202 $oPageEdit->setDateEdit(date("Y-m-d H:i:s")); 176 203 if (getRequest('page_pid')==0) { … … 187 214 $oPageEdit->setTitle(getRequest('page_title')); 188 215 $oPageEdit->setUrl(getRequest('page_url')); 216 $oPageEdit->setSort(getRequest('page_sort')); 189 217 /** 190 218 * Обновляем страницу … … 215 243 $oPage=Engine::GetEntity('PluginPage_Page'); 216 244 $oPage->setActive(getRequest('page_active') ? 1 : 0); 245 $oPage->setMain(getRequest('page_main') ? 1 : 0); 217 246 $oPage->setDateAdd(date("Y-m-d H:i:s")); 218 247 if (getRequest('page_pid')==0) { … … 229 258 $oPage->setTitle(getRequest('page_title')); 230 259 $oPage->setUrl(getRequest('page_url')); 260 $oPage->setSort(getRequest('page_sort')); 231 261 /** 232 262 * Добавляем страницу … … 286 316 } 287 317 /** 318 * Проверяем сортировку 319 */ 320 if (getRequest('page_sort') and !is_numeric(getRequest('page_sort'))) { 321 $this->Message_AddError($this->Lang_Get('page_create_sort_error'),$this->Lang_Get('error')); 322 $bOk=false; 323 } 324 /** 288 325 * Выполнение хуков 289 326 */ -
trunk/plugins/page/classes/modules/page/Page.class.php
r929 r933 187 187 return $this->oMapper->SetPagesPidToNull(); 188 188 } 189 /** 190 * Получает слудующую по сортировке страницу 191 * 192 * @param unknown_type $iSort 193 * @param unknown_type $sWay 194 * @return unknown 195 */ 196 public function GetNextPageBySort($iSort,$sPid,$sWay='up') { 197 return $this->oMapper->GetNextPageBySort($iSort,$sPid,$sWay); 198 } 199 /** 200 * Получает значение максимальной сртировки 201 * 202 * @return unknown 203 */ 204 public function GetMaxSortByPid($sPid) { 205 return $this->oMapper->GetMaxSortByPid($sPid); 206 } 189 207 } 190 208 ?> -
trunk/plugins/page/classes/modules/page/entity/Page.entity.class.php
r892 r933 50 50 public function getActive() { 51 51 return $this->_aData['page_active']; 52 } 53 public function getMain() { 54 return $this->_aData['page_main']; 55 } 56 public function getSort() { 57 return $this->_aData['page_sort']; 52 58 } 53 59 … … 92 98 $this->_aData['page_active']=$data; 93 99 } 100 public function setMain($data) { 101 $this->_aData['page_main']=$data; 102 } 103 public function setSort($data) { 104 $this->_aData['page_sort']=$data; 105 } 94 106 } 95 107 ?> -
trunk/plugins/page/classes/modules/page/mapper/Page.mapper.class.php
r894 r933 28 28 page_seo_keywords, 29 29 page_seo_description, 30 page_active 30 page_active, 31 page_main, 32 page_sort 31 33 ) 32 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?d )34 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?d, ?d, ?d) 33 35 "; 34 if ($iId=$this->oDb->query($sql,$oPage->getPid(),$oPage->getUrl(),$oPage->getUrlFull(),$oPage->getTitle(),$oPage->getText(),$oPage->getDateAdd(),$oPage->getSeoKeywords(),$oPage->getSeoDescription(),$oPage->getActive() ))36 if ($iId=$this->oDb->query($sql,$oPage->getPid(),$oPage->getUrl(),$oPage->getUrlFull(),$oPage->getTitle(),$oPage->getText(),$oPage->getDateAdd(),$oPage->getSeoKeywords(),$oPage->getSeoDescription(),$oPage->getActive(),$oPage->getMain(),$oPage->getSort())) 35 37 { 36 38 return $iId; … … 49 51 page_seo_keywords = ? , 50 52 page_seo_description = ? , 51 page_active = ? 53 page_active = ?, 54 page_main = ?, 55 page_sort = ? 52 56 WHERE page_id = ?d 53 57 "; 54 if ($this->oDb->query($sql,$oPage->getPid(),$oPage->getUrl(),$oPage->getUrlFull(),$oPage->getTitle(),$oPage->getText(),$oPage->getDateEdit(),$oPage->getSeoKeywords(),$oPage->getSeoDescription(),$oPage->getActive(),$oPage->get Id()))58 if ($this->oDb->query($sql,$oPage->getPid(),$oPage->getUrl(),$oPage->getUrlFull(),$oPage->getTitle(),$oPage->getText(),$oPage->getDateEdit(),$oPage->getSeoKeywords(),$oPage->getSeoDescription(),$oPage->getActive(),$oPage->getMain(),$oPage->getSort(),$oPage->getId())) 55 59 { 56 60 return true; … … 103 107 FROM 104 108 ".Config::Get('plugin.page.table.page')." 105 ORDER by page_ title asc;109 ORDER by page_sort desc; 106 110 "; 107 111 if ($aRows=$this->oDb->select($sql)) { … … 134 138 return $aResult; 135 139 } 140 141 public function GetNextPageBySort($iSort,$sPid,$sWay) { 142 if ($sWay=='up') { 143 $sWay='>'; 144 $sOrder='asc'; 145 } else { 146 $sWay='<'; 147 $sOrder='desc'; 148 } 149 $sPidNULL=''; 150 if (is_null($sPid)) { 151 $sPidNULL='page_pid IS NULL and'; 152 } 153 $sql = "SELECT * FROM ".Config::Get('plugin.page.table.page')." WHERE { page_pid = ? and } {$sPidNULL} page_sort {$sWay} ? order by page_sort {$sOrder} limit 0,1"; 154 if ($aRow=$this->oDb->selectRow($sql,is_null($sPid) ? DBSIMPLE_SKIP : $sPid, $iSort)) { 155 return Engine::GetEntity('PluginPage_Page',$aRow); 156 } 157 return null; 158 } 159 160 public function GetMaxSortByPid($sPid) { 161 $sPidNULL=''; 162 if (is_null($sPid)) { 163 $sPidNULL='and page_pid IS NULL'; 164 } 165 $sql = "SELECT max(page_sort) as max_sort FROM ".Config::Get('plugin.page.table.page')." WHERE 1=1 { and page_pid = ? } {$sPidNULL} "; 166 if ($aRow=$this->oDb->selectRow($sql,is_null($sPid) ? DBSIMPLE_SKIP : $sPid)) { 167 return $aRow['max_sort']; 168 } 169 return null; 170 } 136 171 } 137 172 ?> -
trunk/plugins/page/plugin.xml
r925 r933 8 8 </author> 9 9 <homepage>http://livestreet.ru</homepage> 10 <version>1. 0.2</version>10 <version>1.1.0</version> 11 11 <requires> 12 12 <livestreet>0.4.1</livestreet> -
trunk/plugins/page/templates/language/english.php
r900 r933 43 43 'page_create_seo_description' => 'SEO description', 44 44 'page_create_seo_description_notice' => 'SEO optimization description', 45 'page_create_sort' => 'Sort', 46 'page_create_sort_notice' => 'Sets the sorting when displaying', 47 'page_create_sort_error' => 'Sorting must be a number', 45 48 'page_create_active' => 'Show active page', 49 'page_create_main' => 'display on the main page', 46 50 'page_create_submit_save' => 'Save', 47 51 'page_create_submit_save_ok' => 'New page has been created', … … 52 56 'page_admin_url' => 'URL', 53 57 'page_admin_active' => 'Active', 58 'page_admin_main' => 'On main', 59 'page_admin_sort_up' => 'Move up', 60 'page_admin_sort_down' => 'Move down', 54 61 'page_admin_active_yes' => 'Yes', 55 62 'page_admin_active_no' => 'No', -
trunk/plugins/page/templates/language/russian.php
r858 r933 41 41 'page_create_seo_keywords' => 'SEO keywords', 42 42 'page_create_seo_keywords_notice' => 'Ключевые слова для SEO-оптимизации', 43 'page_create_seo_description' => 'SEO description', 43 'page_create_seo_description' => 'SEO description', 44 44 'page_create_seo_description_notice' => 'Описание для SEO-оптимизации', 45 'page_create_sort' => 'Сортировка', 46 'page_create_sort_notice' => 'Устанавливает сортировку при отображении', 47 'page_create_sort_error' => 'Сортировка должна быть числом', 45 48 'page_create_active' => 'показывать страницу', 49 'page_create_main' => 'отображать на главной странице', 46 50 'page_create_submit_save' => 'сохранить', 47 51 'page_create_submit_save_ok' => 'Новая страница добавлена', … … 52 56 'page_admin_url' => 'URL', 53 57 'page_admin_active' => 'Активна', 58 'page_admin_main' => 'На главной', 59 'page_admin_sort_up' => 'Переместить выше', 60 'page_admin_sort_down' => 'Переместить ниже', 54 61 'page_admin_active_yes' => 'да', 55 62 'page_admin_active_no' => 'нет', -
trunk/plugins/page/templates/skin/default/actions/ActionPage/add.tpl
r858 r933 79 79 </p> 80 80 81 <p><label for="page_sort">{$aLang.page_create_sort}:</label><br /> 82 <input type="text" id="page_sort" name="page_sort" value="{$_aRequest.page_sort}" class="w100p" /> 83 <span class="form_note">{$aLang.page_create_sort_notice}</span></p> 84 81 85 <p><input type="checkbox" id="page_active" name="page_active" value="1" {if $_aRequest.page_active==1}checked{/if}/> 82 86 <label for="page_active"> — {$aLang.page_create_active}</label> 87 </p> 88 89 <p><input type="checkbox" id="page_main" name="page_main" value="1" {if $_aRequest.page_main==1}checked{/if}/> 90 <label for="page_main"> — {$aLang.page_create_main}</label> 83 91 </p> 84 92 -
trunk/plugins/page/templates/skin/default/actions/ActionPage/admin.tpl
r858 r933 22 22 <th align="left">{$aLang.page_admin_title}</th> 23 23 <th align="center" width="250px">{$aLang.page_admin_url}</th> 24 <th align="center" width="50px">{$aLang.page_admin_active}</th> 24 <th align="center" width="50px">{$aLang.page_admin_active}</th> 25 <th align="center" width="70px">{$aLang.page_admin_main}</th> 25 26 <th align="center" width="80px">{$aLang.page_admin_action}</th> 26 27 </tr> … … 35 36 <tr class="{$className}" onmouseover="this.className='colored_sel';" onmouseout="this.className='{$className}';"> 36 37 <td align="left" valign="middle"> 37 <img src="{ cfg name='path.static.skin'}/images/{if $oPage->getLevel()==0}folder{else}new{/if}_16x16.gif" alt="" title="" border="0" style="margin-left: {$oPage->getLevel()*20}px;"/>38 <img src="{$sTemplateWebPathPlugin}images/{if $oPage->getLevel()==0}folder{else}new{/if}_16x16.gif" alt="" title="" border="0" style="margin-left: {$oPage->getLevel()*20}px;"/> 38 39 <a href="{router page='page'}{$oPage->getUrlFull()}/">{$oPage->getTitle()}</a> 39 40 </td> … … 48 49 {/if} 49 50 </td> 51 <td align="center"> 52 {if $oPage->getMain()} 53 {$aLang.page_admin_active_yes} 54 {else} 55 {$aLang.page_admin_active_no} 56 {/if} 57 </td> 50 58 <td align="center"> 51 <a href="{router page='page'}admin/edit/{$oPage->getId()}/"><img src="{ cfg name='path.static.skin'}/images/edit.gif" alt="{$aLang.page_admin_action_edit}" title="{$aLang.page_admin_action_edit}" border="0"/></a>59 <a href="{router page='page'}admin/edit/{$oPage->getId()}/"><img src="{$sTemplateWebPathPlugin}images/edit.gif" alt="{$aLang.page_admin_action_edit}" title="{$aLang.page_admin_action_edit}" border="0"/></a> 52 60 53 <a href="{router page='page'}admin/delete/{$oPage->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" onclick="return confirm('«{$oPage->getTitle()}»: {$aLang.page_admin_action_delete_confirm}');"><img src="{cfg name='path.static.skin'}/images/delete.gif" alt="{$aLang.page_admin_action_delete}" title="{$aLang.page_admin_action_delete}" border="0"/></a> 61 <a href="{router page='page'}admin/delete/{$oPage->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" onclick="return confirm('«{$oPage->getTitle()}»: {$aLang.page_admin_action_delete_confirm}');"><img src="{$sTemplateWebPathPlugin}images/delete.gif" alt="{$aLang.page_admin_action_delete}" title="{$aLang.page_admin_action_delete}" border="0"/></a> 62 <a href="{router page='page'}admin/sort/{$oPage->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}"><img src="{$sTemplateWebPathPlugin}images/up.png" alt="{$aLang.page_admin_sort_up}" title="{$aLang.page_admin_sort_up} ({$oPage->getSort()})" /></a> 63 <a href="{router page='page'}admin/sort/{$oPage->getId()}/down/?security_ls_key={$LIVESTREET_SECURITY_KEY}"><img src="{$sTemplateWebPathPlugin}images/down.png" alt="{$aLang.page_admin_sort_down}" title="{$aLang.page_admin_sort_down} ({$oPage->getSort()})" /></a> 54 64 </td> 55 65 </tr> -
trunk/plugins/page/templates/skin/developer/actions/ActionPage/add.tpl
r925 r933 80 80 <input type="text" id="page_seo_description" name="page_seo_description" value="{$_aRequest.page_seo_description}" class="input-wide" /> 81 81 <span class="note">{$aLang.page_create_seo_description_notice}</span></p> 82 83 <p><label for="page_sort">{$aLang.page_create_sort}:</label><br /> 84 <input type="text" id="page_sort" name="page_sort" value="{$_aRequest.page_sort}" class="input-wide" /> 85 <span class="note">{$aLang.page_create_sort_notice}</span></p> 82 86 83 87 <p><label><input type="checkbox" id="page_active" name="page_active" value="1" class="checkbox" {if $_aRequest.page_active==1}checked{/if} />{$aLang.page_create_active}</label></p> 88 89 <p><label><input type="checkbox" id="page_main" name="page_main" value="1" class="checkbox" {if $_aRequest.page_main==1}checked{/if} />{$aLang.page_create_main}</label></p> 84 90 85 91 <p> -
trunk/plugins/page/templates/skin/developer/actions/ActionPage/admin.tpl
r925 r933 25 25 <td align="center" width="250px">{$aLang.page_admin_url}</td> 26 26 <td align="center" width="50px">{$aLang.page_admin_active}</td> 27 <td align="center" width="80px">{$aLang.page_admin_action}</td> 27 <td align="center" width="70px">{$aLang.page_admin_main}</td> 28 <td align="center" width="80px">{$aLang.page_admin_action}</td> 28 29 </tr> 29 30 </thead> … … 46 47 {/if} 47 48 </td> 49 <td align="center"> 50 {if $oPage->getMain()} 51 {$aLang.page_admin_active_yes} 52 {else} 53 {$aLang.page_admin_active_no} 54 {/if} 55 </td> 48 56 <td align="center"> 49 57 <a href="{router page='page'}admin/edit/{$oPage->getId()}/"><img src="{cfg name='path.static.skin'}/images/edit.png" alt="{$aLang.page_admin_action_edit}" title="{$aLang.page_admin_action_edit}" /></a> 50 58 <a href="{router page='page'}admin/delete/{$oPage->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" onclick="return confirm('«{$oPage->getTitle()}»: {$aLang.page_admin_action_delete_confirm}');"><img src="{cfg name='path.static.skin'}/images/delete.png" alt="{$aLang.page_admin_action_delete}" title="{$aLang.page_admin_action_delete}" /></a> 51 </td> 59 <a href="{router page='page'}admin/sort/{$oPage->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}"><img src="{$sTemplateWebPathPlugin}images/up.png" alt="{$aLang.page_admin_sort_up}" title="{$aLang.page_admin_sort_up} ({$oPage->getSort()})" /></a> 60 <a href="{router page='page'}admin/sort/{$oPage->getId()}/down/?security_ls_key={$LIVESTREET_SECURITY_KEY}"><img src="{$sTemplateWebPathPlugin}images/down.png" alt="{$aLang.page_admin_sort_down}" title="{$aLang.page_admin_sort_down} ({$oPage->getSort()})" /></a> 61 </td> 52 62 </tr> 53 63 {/foreach}
