Skip to content

Commit

Permalink
CMS Mostly Working
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepwinter committed Apr 22, 2011
1 parent 7e1ea89 commit f806fd4
Show file tree
Hide file tree
Showing 104 changed files with 35 additions and 29 deletions.
12 changes: 6 additions & 6 deletions modules/mop/MoPUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
}
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
},
Expand Down Expand Up @@ -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 ) } );
Expand Down Expand Up @@ -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 ) } );
Expand Down
3 changes: 3 additions & 0 deletions modules/mopcms/classes/model/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ class Model_Page extends ORM {
protected $_belongs_to = array(
'template'=>array()
);
protected $_has_one = array(
'template'=>array()
);

public $content = null;

Expand Down
1 change: 1 addition & 0 deletions modules/mopcms/classes/model/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
class Model_Template extends ORM {
protected $_has_many = array('page'=>array());
protected $_belongs_to = array('page'=>array());

/*
* Variable: nonmappedfield
Expand Down
42 changes: 22 additions & 20 deletions modules/mopcms/classes/mop/cmsinterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
}
}
Expand All @@ -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);
Expand All @@ -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));
}


Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand All @@ -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++){
Expand All @@ -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');
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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']);
}
Expand Down
Binary file added modules/mopcms/views/css/images/admin/bg_row.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/mopcms/views/css/images/admin/bg_row_alt.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/mopcms/views/css/images/admin/bg_white60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/mopcms/views/css/images/admin/bg_white80.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/mopcms/views/css/images/admin/bgk80.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/mopcms/views/css/images/admin/bgk88.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/mopcms/views/css/images/admin/bgk90.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/mopcms/views/css/images/admin/bgk94.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/mopcms/views/css/images/admin/icon_gif.gif
Binary file added modules/mopcms/views/css/images/admin/icon_jpg.gif
Binary file added modules/mopcms/views/css/images/admin/icon_none.gif
Binary file added modules/mopcms/views/css/images/admin/icon_pdf.gif
Binary file added modules/mopcms/views/css/images/admin/icon_png.gif
Binary file added modules/mopcms/views/css/images/admin/icon_sort.png
Binary file added modules/mopcms/views/css/images/admin/icon_view.png
Binary file added modules/mopcms/views/css/images/admin/navbg.gif
Binary file added modules/mopcms/views/css/images/admin/spinner.gif
Binary file added modules/mopcms/views/css/images/bar.gif
Binary file added modules/mopcms/views/css/images/bg_row.gif
Binary file added modules/mopcms/views/css/images/bg_row_alt.gif
Binary file added modules/mopcms/views/css/images/bg_white60.png
Binary file added modules/mopcms/views/css/images/bg_white80.png
Binary file added modules/mopcms/views/css/images/bgk80.png
Binary file added modules/mopcms/views/css/images/bgk88.png
Binary file added modules/mopcms/views/css/images/bgk90.png
Binary file added modules/mopcms/views/css/images/bgk94.png
Binary file added modules/mopcms/views/css/images/failed.png
Binary file added modules/mopcms/views/css/images/file.png
Binary file added modules/mopcms/views/css/images/guideBg.gif
Binary file added modules/mopcms/views/css/images/icon_addpage.gif
Binary file added modules/mopcms/views/css/images/icon_addpage.jpg
Binary file added modules/mopcms/views/css/images/icon_cancel.gif
Binary file added modules/mopcms/views/css/images/icon_cancel.png
Binary file added modules/mopcms/views/css/images/icon_confirm.gif
Binary file added modules/mopcms/views/css/images/icon_confirm.png
Binary file added modules/mopcms/views/css/images/icon_delete.gif
Binary file added modules/mopcms/views/css/images/icon_delete.png
Binary file added modules/mopcms/views/css/images/icon_doc.gif
Binary file added modules/mopcms/views/css/images/icon_download.png
Binary file added modules/mopcms/views/css/images/icon_folder.gif
Binary file added modules/mopcms/views/css/images/icon_folderadd.gif
Binary file added modules/mopcms/views/css/images/icon_folderopen.gif
Binary file added modules/mopcms/views/css/images/icon_gif.gif
Binary file added modules/mopcms/views/css/images/icon_jpg.gif
Binary file added modules/mopcms/views/css/images/icon_none.gif
Binary file added modules/mopcms/views/css/images/icon_pdf.gif
Binary file added modules/mopcms/views/css/images/icon_png.gif
Binary file added modules/mopcms/views/css/images/icon_published.gif
Binary file added modules/mopcms/views/css/images/icon_sort.png
Binary file added modules/mopcms/views/css/images/icon_sort_hover.png
Binary file added modules/mopcms/views/css/images/icon_trash.gif
Binary file added modules/mopcms/views/css/images/icon_unpublished.gif
Binary file added modules/mopcms/views/css/images/icon_upload.png
Binary file added modules/mopcms/views/css/images/icon_view.png
Binary file added modules/mopcms/views/css/images/navbg.gif
Binary file added modules/mopcms/views/css/images/progress.gif
Binary file added modules/mopcms/views/css/images/spinner.gif
Binary file added modules/mopcms/views/css/images/success.png
Binary file added modules/mopcms/views/css/images/switch_handle.png
Binary file added modules/mopcms/views/css/images/switch_track.png
Binary file added modules/mopcms/views/css/images/uploading.png
4 changes: 2 additions & 2 deletions modules/mopcms/views/js/mop_cms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ){
Expand Down
2 changes: 1 addition & 1 deletion modules/mopcore/classes/controller/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit f806fd4

Please sign in to comment.