Permalink
Browse files

CMS Mostly Working

  • Loading branch information...
1 parent 7e1ea89 commit f806fd4c254b97f8935defdcc2908999d7b75c7e @deepwinter deepwinter committed Apr 22, 2011
Showing with 35 additions and 29 deletions.
  1. +6 −6 modules/mop/MoPUI.js
  2. +3 −0 modules/mopcms/classes/model/page.php
  3. +1 −0 modules/mopcms/classes/model/template.php
  4. +22 −20 modules/mopcms/classes/mop/cmsinterface.php
  5. BIN modules/mopcms/views/css/images/admin/bg_row.gif
  6. BIN modules/mopcms/views/css/images/admin/bg_row_alt.gif
  7. BIN modules/mopcms/views/css/images/admin/bg_white60.png
  8. BIN modules/mopcms/views/css/images/admin/bg_white80.png
  9. BIN modules/mopcms/views/css/images/admin/bgk80.png
  10. BIN modules/mopcms/views/css/images/admin/bgk88.png
  11. BIN modules/mopcms/views/css/images/admin/bgk90.png
  12. BIN modules/mopcms/views/css/images/admin/bgk94.png
  13. BIN modules/mopcms/views/css/images/admin/icon_add_category.gif
  14. BIN modules/mopcms/views/css/images/admin/icon_addpage.gif
  15. BIN modules/mopcms/views/css/images/admin/icon_addpage.jpg
  16. BIN modules/mopcms/views/css/images/admin/icon_cancel.gif
  17. BIN modules/mopcms/views/css/images/admin/icon_cancel.png
  18. BIN modules/mopcms/views/css/images/admin/icon_cancel_hover.png
  19. BIN modules/mopcms/views/css/images/admin/icon_confirm.gif
  20. BIN modules/mopcms/views/css/images/admin/icon_confirm.png
  21. BIN modules/mopcms/views/css/images/admin/icon_confirm_hover.png
  22. BIN modules/mopcms/views/css/images/admin/icon_delete.gif
  23. BIN modules/mopcms/views/css/images/admin/icon_delete.png
  24. BIN modules/mopcms/views/css/images/admin/icon_delete_hover.png
  25. BIN modules/mopcms/views/css/images/admin/icon_download.png
  26. BIN modules/mopcms/views/css/images/admin/icon_folder.gif
  27. BIN modules/mopcms/views/css/images/admin/icon_folder_hover.gif
  28. BIN modules/mopcms/views/css/images/admin/icon_folderadd.gif
  29. BIN modules/mopcms/views/css/images/admin/icon_folderadd_hover.gif
  30. BIN modules/mopcms/views/css/images/admin/icon_folderopen.gif
  31. BIN modules/mopcms/views/css/images/admin/icon_folderopen_hover.gif
  32. BIN modules/mopcms/views/css/images/admin/icon_gif.gif
  33. BIN modules/mopcms/views/css/images/admin/icon_jpg.gif
  34. BIN modules/mopcms/views/css/images/admin/icon_none.gif
  35. BIN modules/mopcms/views/css/images/admin/icon_pdf.gif
  36. BIN modules/mopcms/views/css/images/admin/icon_png.gif
  37. BIN modules/mopcms/views/css/images/admin/icon_published.gif
  38. BIN modules/mopcms/views/css/images/admin/icon_published_hover.gif
  39. BIN modules/mopcms/views/css/images/admin/icon_sort.png
  40. BIN modules/mopcms/views/css/images/admin/icon_sort_hover.png
  41. BIN modules/mopcms/views/css/images/admin/icon_trash.gif
  42. BIN modules/mopcms/views/css/images/admin/icon_unpublished.gif
  43. BIN modules/mopcms/views/css/images/admin/icon_unpublished_hover.gif
  44. BIN modules/mopcms/views/css/images/admin/icon_upload.png
  45. BIN modules/mopcms/views/css/images/admin/icon_view.png
  46. BIN modules/mopcms/views/css/images/admin/navbg.gif
  47. BIN modules/mopcms/views/css/images/admin/spinner.gif
  48. BIN modules/mopcms/views/css/images/admin/switch_handle.png
  49. BIN modules/mopcms/views/css/images/admin/switch_track.png
  50. BIN modules/mopcms/views/css/images/bar.gif
  51. BIN modules/mopcms/views/css/images/bg_row.gif
  52. BIN modules/mopcms/views/css/images/bg_row_alt.gif
  53. BIN modules/mopcms/views/css/images/bg_white60.png
  54. BIN modules/mopcms/views/css/images/bg_white80.png
  55. BIN modules/mopcms/views/css/images/bgk80.png
  56. BIN modules/mopcms/views/css/images/bgk88.png
  57. BIN modules/mopcms/views/css/images/bgk90.png
  58. BIN modules/mopcms/views/css/images/bgk94.png
  59. BIN modules/mopcms/views/css/images/failed.png
  60. BIN modules/mopcms/views/css/images/file.png
  61. BIN modules/mopcms/views/css/images/guideBg.gif
  62. BIN modules/mopcms/views/css/images/icon_add_category.gif
  63. BIN modules/mopcms/views/css/images/icon_addpage.gif
  64. BIN modules/mopcms/views/css/images/icon_addpage.jpg
  65. BIN modules/mopcms/views/css/images/icon_cancel.gif
  66. BIN modules/mopcms/views/css/images/icon_cancel.png
  67. BIN modules/mopcms/views/css/images/icon_cancel_hover.png
  68. BIN modules/mopcms/views/css/images/icon_confirm.gif
  69. BIN modules/mopcms/views/css/images/icon_confirm.png
  70. BIN modules/mopcms/views/css/images/icon_confirm_hover.png
  71. BIN modules/mopcms/views/css/images/icon_delete.gif
  72. BIN modules/mopcms/views/css/images/icon_delete.png
  73. BIN modules/mopcms/views/css/images/icon_delete_hover.png
  74. BIN modules/mopcms/views/css/images/icon_doc.gif
  75. BIN modules/mopcms/views/css/images/icon_download.png
  76. BIN modules/mopcms/views/css/images/icon_folder.gif
  77. BIN modules/mopcms/views/css/images/icon_folder_hover.gif
  78. BIN modules/mopcms/views/css/images/icon_folderadd.gif
  79. BIN modules/mopcms/views/css/images/icon_folderadd_hover.gif
  80. BIN modules/mopcms/views/css/images/icon_folderopen.gif
  81. BIN modules/mopcms/views/css/images/icon_folderopen_hover.gif
  82. BIN modules/mopcms/views/css/images/icon_gif.gif
  83. BIN modules/mopcms/views/css/images/icon_jpg.gif
  84. BIN modules/mopcms/views/css/images/icon_none.gif
  85. BIN modules/mopcms/views/css/images/icon_pdf.gif
  86. BIN modules/mopcms/views/css/images/icon_png.gif
  87. BIN modules/mopcms/views/css/images/icon_published.gif
  88. BIN modules/mopcms/views/css/images/icon_published_hover.gif
  89. BIN modules/mopcms/views/css/images/icon_sort.png
  90. BIN modules/mopcms/views/css/images/icon_sort_hover.png
  91. BIN modules/mopcms/views/css/images/icon_trash.gif
  92. BIN modules/mopcms/views/css/images/icon_unpublished.gif
  93. BIN modules/mopcms/views/css/images/icon_unpublished_hover.gif
  94. BIN modules/mopcms/views/css/images/icon_upload.png
  95. BIN modules/mopcms/views/css/images/icon_view.png
  96. BIN modules/mopcms/views/css/images/navbg.gif
  97. BIN modules/mopcms/views/css/images/progress.gif
  98. BIN modules/mopcms/views/css/images/spinner.gif
  99. BIN modules/mopcms/views/css/images/success.png
  100. BIN modules/mopcms/views/css/images/switch_handle.png
  101. BIN modules/mopcms/views/css/images/switch_track.png
  102. BIN modules/mopcms/views/css/images/uploading.png
  103. +2 −2 modules/mopcms/views/js/mop_cms.js
  104. +1 −1 modules/mopcore/classes/controller/ajax.php
View
@@ -385,14 +385,14 @@ mop.ui.UIElement = new Class({
if( json && json.error ){
this.validationSticky = new mop.ui.Sticky( this, {
title: "Error:",
- message: json.message,
+ message: json.response.message,
scrollContext: this.options.scrollContext
});
this.validationSticky.show();
}else{
if( this.onCompleteCallbacks.length > 0 ){
for( var i = 0; i < this.onCompleteCallbacks.length; i++ ){
- this.onCompleteCallbacks[i]( json, this );
+ this.onCompleteCallbacks[i]( json.response, this );
}
}
}
@@ -433,7 +433,7 @@ mop.ui.UIElement = new Class({
if( this.showSaving ) this.showSaving();
- var url = mop.util.getAppURL() + this.marshal.getSubmissionController() + "/ajax/" + this.action + "/" + this.marshal.getObjectId();
+ var url = mop.util.getAppURL() +"ajax/data/" + this.marshal.getSubmissionController() + "/" + this.action + "/" + this.marshal.getObjectId();
var submittedVars = { field: this.fieldName, value: val };
console.log( "SUBMIT ", url, submittedVars );
@@ -2296,7 +2296,7 @@ mop.ui.FileElement = new Class({
},
getSubmitURL: function(){
- var url = mop.util.getAppURL() + this.marshal.getSubmissionController() + "/ajax/" + this.action + "/" + this.marshal.getObjectId();
+ var url = mop.util.getAppURL() + "ajax/data/" + this.marshal.getSubmissionController() + "/" + this.action + "/" + this.marshal.getObjectId();
// console.log( ":::: ", this.toString(), "getSubmitURL: ", url );
return url;
},
@@ -3106,7 +3106,7 @@ mop.ui.CheckBox = new Class({
if( this.showSaving ) this.showSaving();
- var url = mop.util.getAppURL() + this.marshal.getSubmissionController() + "/ajax/" + this.action + "/" + this.marshal.getObjectId();
+ var url = mop.util.getAppURL() + "ajax/data/" + this.marshal.getSubmissionController() + "/" + this.action + "/" + this.marshal.getObjectId();
var submittedVars = { field: this.fieldName, value: val };
console.log( this.toString(), "submit", url, submittedVars );
mop.util.JSONSend( url, submittedVars, { onComplete: this.onResponse.bind( this ) } );
@@ -4061,7 +4061,7 @@ mop.ui.PaginationControls = new Class({
}else{
this.spinner.removeClass( "hidden" );
var marshalId = ( this.marshal.instanceName )? this.marshal.instanceName : this.marshal.get("id");
- var url = mop.util.getAppURL() + marshalId + "/ajax/" + this.method + "/" + this.listId + "/" + this.currentPage;
+ var url = mop.util.getAppURL() + "ajax/data/" + marshalId + "/" + this.method + "/" + this.listId + "/" + this.currentPage;
var postData = ( this.marshal.getPaginationPostData )? this.marshal.getPaginationPostData() : null ; //getGeneratedDataQueryString() : null;
// console.log( this.toString(), "paginate uncached page >> ", url, postData );
mop.util.JSONSend( url, postData, { onComplete: this.onPagination.bind( this ) } );
@@ -8,6 +8,9 @@ class Model_Page extends ORM {
protected $_belongs_to = array(
'template'=>array()
);
+ protected $_has_one = array(
+ 'template'=>array()
+ );
public $content = null;
@@ -5,6 +5,7 @@
*/
class Model_Template extends ORM {
protected $_has_many = array('page'=>array());
+ protected $_belongs_to = array('page'=>array());
/*
* Variable: nonmappedfield
@@ -34,9 +34,9 @@ public function __construct($request, $response){
'result'=>'success',
);
*/
- public function saveFile($pageid){
+ public function action_saveFile($pageid){
- $file = cms::saveHttpPostFile($pageid, $_POST['field'], $_FILES[$_POST['field']]);
+ $file = mopcms::saveHttpPostFile($pageid, $_POST['field'], $_FILES[$_POST['field']]);
$result = array(
'id'=>$file->id,
'src'=>$file->original->fullpath,
@@ -48,8 +48,8 @@ public function saveFile($pageid){
//if it's an image
$thumbSrc = null;
if($file->uithumb->filename){
- if(file_exists(cms::mediapath().$file->uithumb->filename)){
- $resultpath = cms::mediapath().$file->uithumb->filename;
+ if(file_exists(mopcms::mediapath().$file->uithumb->filename)){
+ $resultpath = mopcms::mediapath().$file->uithumb->filename;
$thumbSrc = Kohana::config('cms.basemediapath').$file->uithumb->filename;
}
}
@@ -75,19 +75,20 @@ public function saveFile($pageid){
* $_POST['value'] - the value to save
* Returns: array('value'=>{value})
*/
- public function savefield($id){
- $page = ORM::Factory('page')->find($id);
+ public function action_savefield($id){
+ $page = ORM::Factory('page', $id);
+
if($_POST['field']=='slug'){
- $page->slug = cms::createSlug($_POST['value'], $page->id);
+ $page->slug = mopcms::createSlug($_POST['value'], $page->id);
$page->decoupleSlugTitle = 1;
$page->save();
return array('value'=>$page->slug);
} else if($_POST['field']=='title'){ //update slug, but actually we may not want to have slug updatable
if(!$page->decoupleSlugTitle){
- $page->slug = cms::createSlug($_POST['value'], $page->id);
+ $page->slug = mopcms::createSlug($_POST['value'], $page->id);
}
$page->save();
- $page->contenttable->$_POST['field'] = cms::convertNewlines($_POST['value']);
+ $page->contenttable->$_POST['field'] = mopcms::convertNewlines($_POST['value']);
$page->contenttable->save();
$page = ORM::Factory('page')->find($id);
return array('value'=>$page->contenttable->$_POST['field'], 'slug'=>$page->slug);
@@ -96,11 +97,12 @@ public function savefield($id){
$page->$_POST['field'] = $_POST['value'];
$page->save();
} else if($_POST['field']) {
- $fieldInfo = mop::config('objects', sprintf('//template[@name="%s"]/elements/*[@field="%s"]',
- $page->template->templatename,
- $_POST['field']))->item(0);
+ $xpath = sprintf('//template[@name="%s"]/elements/*[@field="%s"]',
+ $page->template->templatename,
+ $_POST['field']);
+ $fieldInfo = mop::config('objects', $xpath)->item(0);
if(!$fieldInfo){
- die('Invalid field for template. Check for correct page/object ID in URL');
+ throw new Kohana_Exception('Invalid field for template, using XPath : :xpath', array(':xpath'=>$xpath));
}
@@ -129,7 +131,7 @@ public function savefield($id){
$object->contenttable->save();
break;
default:
- $page->contenttable->$_POST['field'] = cms::convertNewlines($_POST['value']);
+ $page->contenttable->$_POST['field'] = mopcms::convertNewlines($_POST['value']);
$page->contenttable->save();
break;
}
@@ -148,7 +150,7 @@ public function savefield($id){
id - the id to toggle
Returns: Published status (0 or 1)
*/
- public function togglePublish($id){
+ public function action_togglePublish($id){
$page = ORM::Factory('page')->find($id);
if($page->published==0){
$page->published = 1;
@@ -166,7 +168,7 @@ public function togglePublish($id){
Parameters:
$_POST['sortorder'] - array of page ids in their new sort order
*/
- public function saveSortOrder(){
+ public function action_saveSortOrder(){
$order = explode(',', $_POST['sortorder']);
for($i=0; $i<count($order); $i++){
@@ -186,7 +188,7 @@ public function saveSortOrder(){
deletes a page/category and all categories and leaves underneath
Returns: returns html for undelete pane
*/
- public function delete($id){
+ public function action_delete($id){
$this->cascade_delete($id);
$this->view = new View('mop_cms_undelete');
@@ -201,7 +203,7 @@ public function delete($id){
Returns: 1;
*/
- public function undelete($id) {
+ public function action_undelete($id) {
$this->cascade_undelete($id);
//should return something about failure...
return 1;
@@ -242,7 +244,7 @@ private function cascade_delete($id){
private function cascade_undelete($page_id){
$page = ORM::Factory('page')->find($id);
$page->activity = new Database_Expr('NULL');
- $page->slug = cms::createSlug($page->contenttable->title, $page->id);
+ $page->slug = mopcms::createSlug($page->contenttable->title, $page->id);
$page->save();
$page->contenttable->activity = new Database_Expr('NULL');;
$page->contenttable->save();
@@ -260,7 +262,7 @@ private function cascade_undelete($page_id){
Function: saveFieldMapping($itemid)
Wrapper to saveFieldMapping in CMS_Services_Controller
*/
- public function saveFieldMapping($itemid){
+ public function action_saveFieldMapping($itemid){
$object = ORM::Factory($this->model, $itemid);
return $object->saveFieldMapping($_POST['field'], $_POST['value']);
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
@@ -69,10 +69,10 @@ mop.modules.CMS = new Class({
console.log( this.toString(), "loadJS loading ", urlString );
mop.util.loadJS( urlString, { type: "text/javascript", onload: this.onJSLoaded.bind( this, [ pageData.html, this.currentPageLoadIndex ] ) } );
}, this);
- }else{
- this.populate( pageData.html );
}
+ this.populate( pageData.html );
+
},
onJSLoaded: function( pageHTML, pageLoadCount ){
@@ -29,9 +29,9 @@ public function action_data($uri)
} catch (Exception $e) {
$ajaxResponse = array(
'returnValue' => TRUE,
- 'response'=>$data
);
echo "CALL A FUNCITON HERE TO COMMUNICATION EXCEPTION TO CLIENTSIDE";
+ throw $e;
return;
}
$ajaxResponse = array(

0 comments on commit f806fd4

Please sign in to comment.