Changeset 58
- Timestamp:
- 06/11/07 16:43:53 (1 year ago)
- Files:
-
- branch/controllers/posts_controller.php (modified) (4 diffs)
- branch/models/post.php (modified) (2 diffs)
- branch/views/elements/js_include.ctp (modified) (1 diff)
- branch/views/layouts/default.ctp (deleted)
- branch/views/posts/admin_add.ctp (modified) (3 diffs)
- branch/views/posts/admin_edit.ctp (modified) (2 diffs)
- branch/webroot/js/webrocket.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branch/controllers/posts_controller.php
r57 r58 6 6 // Set the default Paginate values 7 7 var $paginate = array('fields'=>array('Post.id', 'Post.title', 'Post.byline', 'Post.body', 'Post.comments_count' ,'Post.user_id', 'Post.stub' ,'Post.post_date' , 'Post.access_level', 'Post.frontpage' ,'Post.published' ,'User.id', 'User.username', 'Subject.id' ,'Subject.title'),'limit'=>10, 'order'=>array('Post.post_date'=>'DESC', 'Post.created' => 'DESC')); 8 8 9 9 function index() { 10 10 // Increase recursion to get post tags and comments … … 107 107 function admin_add() { 108 108 if(!empty($this->data)) { 109 $this->data['Post']['user_id'] = $this->othAuth->user('id'); 109 110 $this->cleanUpFields(); 110 111 $this->Post->create(); … … 116 117 } 117 118 } 118 $this->set('author_id', $this->othAuth->user('id'));119 119 $this->set('access_levels', $this->Group->generateList(null, 'Group.name ASC', null,'{n}.Group.level', '{n}.Group.name')); 120 120 $this->set('subjects', $this->Post->Subject->generateList()); … … 130 130 if($this->Post->save($this->data)) { 131 131 $this->Session->setFlash('The Post saved'); 132 $this->redirect(array('action'=>'index'), null, true); 132 //$this->redirect(array('action'=>'index'), null, true); 133 pr($this->data); 133 134 } else { 134 135 $this->Session->setFlash('The Post could not be saved. Please, try again.'); branch/models/post.php
r57 r58 12 12 'subject_id' => VALID_NOT_EMPTY, 13 13 'access_level' => VALID_NOT_EMPTY, 14 'stub' => VALID_NOT_EMPTY,14 /*'stub' => VALID_NOT_EMPTY,*/ 15 15 'tags' => VALID_NOT_EMPTY, 16 16 'published' => VALID_NOT_EMPTY, … … 62 62 'insertQuery' => ''), 63 63 ); 64 65 function beforeSave() 66 { 67 if (empty($this->id)) 68 { 69 $this->data[$this->name]['stub'] = $this->getUniqueUrl($this->data[$this->name]['title'], 'stub'); 70 } 71 72 return true; 73 } 64 74 } 65 75 ?> branch/views/elements/js_include.ctp
r57 r58 1 1 <?php e($javascript->link('jquery'));?> 2 2 <?php e($javascript->link('wymeditor/jquery.wymeditor'));?> 3 <?php e($javascript->link('wymeditor/plugins/tidy/jquery.wymeditor.tidy'));?> 4 <?php e($javascript->link('wymeditor/plugins/hovertools/jquery.wymeditor.hovertools'));?> 3 5 <?php e($javascript->link('webrocket'));?> branch/views/posts/admin_add.ctp
r57 r58 6 6 <?php echo $form->input('title', array('class' => 'required'));?> 7 7 <?php echo $form->input('byline', array('class' => 'required'));?> 8 <?php echo $form->input('body', array('class' => 'required'));?> 9 <?php echo $form->input('user_id', array('class' => 'required', 'value' => $author_id));?> 8 <?php echo $form->input('body',array('class'=>'wymeditor'));?> 10 9 </fieldset> 11 10 … … 13 12 <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 14 13 <?php echo $form->input('tags', array('class' => 'required', 'type'=>'text'));?> 15 <?php echo $form->input('stub', array('class' => 'required'));?>16 14 </fieldset> 17 15 … … 24 22 </fieldset> 25 23 26 <?php echo $form->submit('Add' );?>24 <?php echo $form->submit('Add', array('class'=>'wymupdate'));?> 27 25 </form> 28 26 </div> branch/views/posts/admin_edit.ctp
r57 r58 7 7 <?php echo $form->input('title', array('class' => 'required'));?> 8 8 <?php echo $form->input('byline', array('class' => 'required'));?> 9 <?php echo $form->input('body', array('class' => 'required'));?>9 <?php echo $form->input('body', array('class'=>'wymeditor'));?> 10 10 <?php echo $form->input('user_id', array('class' => 'required'));?> 11 11 </fieldset> … … 26 26 </fieldset> 27 27 28 <?php echo $form->submit(' Add');?>28 <?php echo $form->submit('Update', array('class'=>'wymupdate'));?> 29 29 <li><?php echo $html->link('Delete', array('action'=>'delete', $html->tagValue('Post/id')), null, 'Are you sure you want to delete #' . $html->tagValue('Post/id')); ?> 30 30 </form> branch/webroot/js/webrocket.js
r57 r58 2 2 3 3 $j(function() { 4 $j('#PostBody').wymeditor(); 4 5 $j(".wymeditor").wymeditor({ 6 7 classesItems:[ 8 {name:"date", title:"PARA: Date", expr:"p"}, 9 {name:"hidden-note", title:"PARA: Hidden note", expr:"p[@class!=\"important\"]"}, 10 {name:"important", title:"PARA: Important", expr:"p[@class!=\"hidden-note\"]"}, 11 {name:"border", title:"IMG: Border", expr:"img"}, 12 {name:"special", title:"LIST: Special", expr:"ul, ol"}], 13 14 editorStyles:[ 15 {name:".hidden-note", css:"color: #999; border: 2px solid #ccc;"}, 16 {name:".border", css:"border: 4px solid #ccc;"}, 17 {name:".date", css:"background-color: #ff9; border: 2px solid #ee9;"}, 18 {name:".important", css:"color: red; font-weight: bold; border: 2px solid red;"}, 19 {name:".special", css:"background-color: #fc9; border: 2px solid red;"}], 20 21 dialogStyles:[ 22 {name:".hidden-note", css:"display: none;"}, 23 {name:".border", css:"border: 1px solid #ccc;"}, 24 {name:".date", css:"color: #ccf;"}, 25 {name:".important", css:"color: red; font-weight: bold;"}, 26 {name:".special", css:"color: green;"}], 27 28 postInit:function (wym) { 29 wym.status(" "); 30 var wymtidy = wym.tidy({sUrl:"/js/wymeditor/plugins/tidy/tidy.php", sButtonHtml:"<li class='wym_tools_tidy'><a name='CleanUp' href='#' style='background-image: url(/js/wymeditor/plugins/tidy/wand.png)'>Clean up HTML</a></li>"}); 31 wymtidy.init();wym.hovertools();}, postInitDialog:function (wym, wdw) {var body = wdw.document.body;var sSelectLink = "<div class='row row-indent'><select class='wym_select_link'><option selected value='WYMeditor http://www.wymeditor.org/'>WYMeditor</option><option value='SourceForge http://www.sourceforge.net/'>SourceForge</option><option value='GNU http://www.gnu.org/'>GNU</option></select><input class='wym_choose' type='button' value='{Choose}' /></div>"; 32 $j(body).filter(".wym_dialog_link").find("fieldset").eq(0).prepend(wym.replaceStrings(sSelectLink)); 33 $j(body).find(".wym_choose").click(function () {var sVal = $j(body).find(".wym_select_link").val(); 34 $j(body).find(".wym_href").val(sVal.substring(sVal.lastIndexOf(" ") + 1)); 35 $j(body).find(".wym_title").val(sVal.substr(0, sVal.lastIndexOf(" ")));});} 36 }); 37 38 $j(".wymsubmit").click(function () {alert($j(this).siblings(".wymeditor").val());}); 39 5 40 $j("ul.mytreemenu").Treeview({speed: "slow", collapsed: true}); 6 41 });