function addWhereWithMasterTable()
 {
     if ($this->masterPageType == PAGE_ADD) {
         return "1=0";
     }
     return ListPage::addWhereWithMasterTable();
 }
 function getMasterTableSQLClause()
 {
     if ($this->masterPageType == PAGE_ADD) {
         return "1=0";
     }
     return ListPage::getMasterTableSQLClause();
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     $layoutExamples = array();
     $layoutExamples[] = new Example('Markup Inheretence', MarkupInheritancePage::getIdentifier());
     $layoutExamples[] = new Example('Panels', PanelPage::getIdentifier());
     $layoutExamples[] = new Example('Borders', BorderPage::getIdentifier());
     $generalExamples = array();
     $generalExamples[] = new Example('Labels', LabelPage::getIdentifier());
     $generalExamples[] = new Example('Links', LinkPage::getIdentifier());
     $generalExamples[] = new Example('Lists', ListPage::getIdentifier());
     $generalExamples[] = new Example('Tabs', TabPanelPage::getIdentifier());
     $formExamples = array();
     $formExamples[] = new Example('Form Fields', FormPage::getIdentifier());
     $formExamples[] = new Example('Validation', ValidationPage::getIdentifier());
     $formExamples[] = new Example('Special Fields', SpecialFields::getIdentifier());
     $tableExamples = array();
     $tableExamples[] = new Example('Data Table', DataTablePage::getIdentifier());
     $ajaxExamples = array();
     $ajaxExamples[] = new Example('Ajax Link', AjaxLinkPage::getIdentifier());
     $ajaxExamples[] = new Example('Ajax Button', AjaxButtonPage::getIdentifier());
     $authoExamples[] = new Example('Authorised Access Page', AuthorisedPage::getIdentifier());
     $examples = array();
     $examples[] = new ExampleType('General', $generalExamples);
     $examples[] = new ExampleType('Layout', $layoutExamples);
     $examples[] = new ExampleType('Form Components', $formExamples);
     $examples[] = new ExampleType('Data Tables', $tableExamples);
     $examples[] = new ExampleType('Ajax', $ajaxExamples);
     $examples[] = new ExampleType('Security', $authoExamples);
     $self = $this;
     $this->add(new ListView('examples', function (picon\ListItem $item) use($self) {
         $type = $item->getModelObject();
         $item->add(new picon\Label('title', new picon\BasicModel($type->name)));
         $item->add(new ListView('list', function (picon\ListItem $item) use($self) {
             $link = new picon\Link('link', function () use($item, $self) {
                 $self->setPage($item->getModelObject()->page);
             });
             $item->add($link);
             $link->add(new picon\Label('exampleName', new picon\BasicModel($item->getModelObject()->name)));
         }, new picon\ArrayModel($type->examples)));
     }, new ArrayModel($examples)));
 }
     $rtl = $xt->getReadingOrder() == 'RTL' ? 'RTL' : '';
     $xt->cssFiles[] = array("stylepath" => "styles/" . $layout->style . '/style' . $rtl . ".css", "pagestylepath" => "pagestyles/" . $layout->name . $rtl . ".css");
     $xt->IEcssFiles[] = array("stylepathIE" => "styles/" . $layout->style . '/styleIE' . ".css");
 }
 $options['xt'] = new Xtempl();
 $options['id'] = $dpParams['ids'][$d];
 $options['flyId'] = $flyId++;
 $mkr = 1;
 foreach ($mKeys[$strTableName] as $mk) {
     if ($defvalues[$mk]) {
         $options['masterKeysReq'][$mkr++] = $defvalues[$mk];
     } else {
         $options['masterKeysReq'][$mkr++] = '';
     }
 }
 $listPageObject = ListPage::createListPage($strTableName, $options);
 // prepare code
 $listPageObject->prepareForBuildPage();
 $flyId = $listPageObject->recId + 1;
 //set page events
 foreach ($listPageObject->eventsObject->events as $event => $name) {
     $listPageObject->xt->assign_event($event, $listPageObject->eventsObject, $event, array());
 }
 //add detail settings to master settings
 $listPageObject->addControlsJSAndCSS();
 $listPageObject->fillSetCntrlMaps();
 $pageObject->jsSettings['tableSettings'][$strTableName] = $listPageObject->jsSettings['tableSettings'][$strTableName];
 $dControlsMap[$strTableName] = $listPageObject->controlsMap;
 $dViewControlsMap[$strTableName] = $listPageObject->viewControlsMap;
 foreach ($listPageObject->jsSettings["global"]["shortTNames"] as $tName => $shortTName) {
     $pageObject->settingsMap["globalSettings"]["shortTNames"][$tName] = $shortTName;
 /**
  * Add common html code for simple mode on list page
  */
 function addCommonHtml()
 {
     $this->body["begin"] .= "<script type=\"text/javascript\" src=\"include/loadfirst.js\"></script>";
     $this->body["begin"] .= "<script type=\"text/javascript\" src=\"include/lang/" . getLangFileName(mlang_getcurrentlang()) . ".js\"></script>";
     if ($this->isDisplayLoading) {
         $this->body["begin"] .= "<script type=\"text/javascript\">Runner.runLoading(" . $this->id . ",document.body,0);</script>";
     }
     //$this->AddJSFile("include/customlabels");
     //add parent common html code
     parent::addCommonHtml();
     // assign body end
     $this->body['end'] = array();
     $this->body['end']["method"] = "assignBodyEnd";
     $this->body['end']["object"] =& $this;
 }
Example #6
0
    // get the artist & album values
    list($artist, $album) = explode('|', Music::decode($request->param('album')));
    // get the list of songs
    $list = Album::getSongs($artist, $album);
    // walk the array and construct URLs
    // The encoded URL value is actually "artist name|album title". The artist
    // name is included to ensure that albums with the same name are not
    // conflated and the pipe character is a delimiter
    array_walk($list, function (&$v, $k) use($artist, $album) {
        $v = array('name' => $v['Title'], 'url' => '/album/' . Music::encode($artist . '|' . $album) . '/song/' . Music::encode($v['file']));
    });
    // build the "previous" link data
    $previous = array('path' => '/album', 'text' => 'Albums');
    // build the shuffle link
    $shuffle = '/album/' . Music::encode($artist . '|' . $album) . '/song/shuffle';
    return ListPage::render($album, $previous, $shuffle, false, $list);
});
//		album/1/song/2	- load all songs for album=1, play song=2, go to nowplaying
//
$klein->respond('GET', '/album/[:album]/song/[:song]', function ($request, $response) {
    // get the parameters
    // get the artist & album values
    list($artist, $album) = explode('|', Music::decode($request->param('album')));
    $song = $request->param('song');
    $song = $song == 'shuffle' ? 'shuffle' : Music::decode($song);
    // clear the playlist
    Music::send('clear');
    // get the list of songs
    $songs = Album::getSongs($artist, $album);
    // load the playlist with the requested songs (and figure out the current
    // song position)
Example #7
0
 function commonAssign()
 {
     $this->xt->assign_loopsection("groups", $this->smartyGroups);
     parent::commonAssign();
     // assign headcheckboxes
     $this->xt->assign("add_headcheckbox", "id=\"cbadd\"");
     $this->xt->assign("edt_headcheckbox", "id=\"cbedt\"");
     $this->xt->assign("del_headcheckbox", "id=\"cbdel\"");
     $this->xt->assign("lst_headcheckbox", "id=\"cblst\"");
     $this->xt->assign("exp_headcheckbox", "id=\"cbexp\"");
     $this->xt->assign("imp_headcheckbox", "id=\"cbimp\"");
     $this->xt->assign("adm_headcheckbox", "id=\"cbadm\"");
     // assign attrs
     $this->xt->assign("addgroup_attrs", "id=\"addGroupBtn\"");
     $this->xt->assign("delgroup_attrs", "id=\"delGroupBtn\"");
     $this->xt->assign("rengroup_attrs", "id=\"renGroupBtn\"");
     $this->xt->assign("savegroup_attrs", "id=\"saveGroupBtn\"");
     $this->xt->assign("savebutton_attrs", "id=\"saveBtn\"");
     $this->xt->assign("resetbutton_attrs", "id=\"resetBtn\"");
     $this->xt->assign("cancelgroup_attrs", "id=\"cancelBtn\"");
     // assign blocks
     $this->xt->assign("grid_block", true);
     $this->xt->assign("menu_block", true);
     $this->xt->assign("left_block", true);
     $this->xt->assign("rights_block", true);
     $this->xt->assign("message_block", true);
     $this->xt->assign("security_block", true);
     $this->xt->assign("logoutbutton", isSingleSign());
     $this->xt->assign("shiftstyle_block", true);
     $this->xt->assign("savebuttons_block", true);
     $this->xt->assign("search_records_block", true);
     $this->xt->assign("recordcontrols_block", true);
     // assign user settings
     $this->xt->assign("username", htmlspecialchars($_SESSION["UserName"]));
     if ($this->createLoginPage) {
         $this->xt->assign("userid", htmlspecialchars($_SESSION["UserID"]));
     }
     $this->xt->displayBrickHidden("message");
 }
Example #8
0
 /**
  * Add common html code for simple mode on list page
  */
 function addCommonHtml()
 {
     $this->body["begin"] .= GetBaseScriptsForPage($this->isDisplayLoading);
     //add parent common html code
     parent::addCommonHtml();
     // assign body end
     $this->body['end'] = array();
     AssignMethod($this->body['end'], "assignBodyEnd", $this);
 }
Example #9
0
 function commonAssign()
 {
     $this->xt->assign_loopsection("groups", $this->smartyGroups);
     parent::commonAssign();
     // assign headcheckboxes
     foreach ($this->permissionNames as $perm => $t) {
         $this->xt->assign($perm . "_headcheckbox", " id=\"colbox" . $perm . "\" data-perm=\"" . $perm . "\"");
     }
     // assign attrs
     $this->xt->assign("addgroup_attrs", "id=\"addGroupBtn\"");
     $this->xt->assign("delgroup_attrs", "id=\"delGroupBtn\"");
     $this->xt->assign("rengroup_attrs", "id=\"renGroupBtn\"");
     $this->xt->assign("savegroup_attrs", "id=\"saveGroupBtn\"");
     $this->xt->assign("savebutton_attrs", "id=\"saveBtn\"");
     $this->xt->assign("resetbutton_attrs", "id=\"resetBtn\"");
     $this->xt->assign("cancelgroup_attrs", "id=\"cancelBtn\"");
     // assign blocks
     $this->xt->assign("grid_block", true);
     $this->xt->assign("menu_block", true);
     $this->xt->assign("left_block", true);
     $this->xt->assign("rights_block", true);
     $this->xt->assign("message_block", true);
     $this->xt->assign("security_block", true);
     $this->xt->assign("logoutbutton", isSingleSign());
     $this->xt->assign("savebuttons_block", true);
     $this->xt->assign("search_records_block", true);
     $this->xt->assign("recordcontrols_block", true);
     // assign user settings
     // The user might rewrite $_SESSION["UserName"] value with HTML code in an event, so no encoding will be performed while printing this value.
     $this->xt->assign("username", $_SESSION["UserName"]);
     if ($this->createLoginPage) {
         $this->xt->assign("userid", runner_htmlspecialchars($_SESSION["UserID"]));
     }
     $this->xt->displayBrickHidden("message");
 }
Example #10
0
 /**
  * @param String listTName
  * @param Number listId
  * @param &Array data
  */
 protected function setDetailList($listTName, $listId, &$data)
 {
     include_once getabspath('classes/listpage.php');
     include_once getabspath('classes/listpage_embed.php');
     include_once getabspath('classes/listpage_dpinline.php');
     //array of params for classes
     $options = array();
     $options["id"] = $listId;
     $options["firstTime"] = 1;
     $options["mode"] = LIST_DETAILS;
     $options["pageType"] = PAGE_LIST;
     $options["masterTable"] = $this->tName;
     $options["masterPageType"] = $this->pageType;
     $options["mainMasterPageType"] = $this->pageType;
     $options["xt"] = new Xtempl(true);
     //#9607 1. Temporary fix
     $options["flyId"] = $this->genId() + 1;
     $options["masterKeysReq"] = array();
     $mkr = 1;
     $mKeys = $this->pSet->getMasterKeysByDetailTable($listTName);
     $masterKeys = array();
     //for PAGE_EDIT only
     foreach ($mKeys as $mk) {
         $options["masterKeysReq"][$mkr] = $data[$mk];
         $masterKeys["masterKey" . $mkr] = $data[$mk];
         $mkr++;
     }
     $listPageObject = ListPage::createListPage($listTName, $options);
     $listPageObject->prepareForBuildPage();
     if ($listPageObject->isDispGrid()) {
         //set page events
         foreach ($listPageObject->eventsObject->events as $event => $name) {
             $listPageObject->xt->assign_event($event, $listPageObject->eventsObject, $event, array());
         }
         //add detail settings to master settings
         $listPageObject->addControlsJSAndCSS();
         $listPageObject->fillSetCntrlMaps();
         $this->copyDetailPreviewJSAndCSS($listPageObject);
         $this->assignDisplayDetailTableXtVariable($listPageObject);
         $this->updateSettingsWidthDPData($listPageObject);
         $this->viewControlsMap["dViewControlsMap"][$listTName] = $listPageObject->viewControlsMap;
         $this->controlsMap["dControlsMap"][$listTName] = $listPageObject->controlsMap;
         if ($this->pageType == PAGE_EDIT) {
             $this->controlsMap["dControlsMap"]["masterKeys"] = $masterKeys;
         }
         $this->controlsMap["dpTablesParams"][] = array("tName" => $listTName, "id" => $options["id"], "pType" => PAGE_LIST);
     }
     $this->flyId = $listPageObject->recId + 1;
 }
Example #11
0
    // get the params
    $playlist = Music::decode($request->param('playlist'));
    // get the list of songs
    $list = Playlist::getSongs($playlist);
    // walk the array and construct URLs
    // The encoded URL value is actually "artist name|album title". The artist
    // name is included to ensure that albums with the same name are not
    // conflated and the pipe character is a delimiter
    array_walk($list, function (&$v, $k) use($playlist) {
        $v = array('name' => $v['Title'], 'url' => '/playlist/' . Music::encode($playlist) . '/song/' . Music::encode($v['file']));
    });
    // build the "previous" link data
    $previous = array('path' => '/playlist', 'text' => 'Playlists');
    // build the shuffle link
    $shuffle = '/playlist/' . Music::encode($playlist) . '/song/shuffle';
    return ListPage::render($playlist, $previous, $shuffle, false, $list);
});
//		playlist/1/song/2 	- load all songs for playlist=1, start playing song=2, go to nowplaying
//
$klein->respond('GET', '/playlist/[:playlist]/song/[:song]', function ($request, $response) {
    // get the params
    $playlist = Music::decode($request->param('playlist'));
    $song = $request->param('song');
    $song = $song == 'shuffle' ? 'shuffle' : Music::decode($song);
    // clear the playlist
    Music::send('clear');
    // get the list of songs
    $songs = Playlist::getSongs($playlist);
    // load the playlist with the requested songs (and figure out the current
    // song position)
    $pos = 0;
Example #12
0
    // conflated and the pipe character is a delimiter
    array_walk($list, function (&$v, $k) {
        $v = array('name' => $v['Title'], 'url' => '/song/' . Music::encode($v['file']));
    });
    $list = array_filter($list, function ($v) {
        return $v['name'] ? true : false;
    });
    usort($list, function ($a, $b) {
        if (array_key_exists('name', $a) && array_key_exists('name', $b)) {
            return $a['name'] < $b['name'] ? -1 : 1;
        }
        return 0;
    });
    // build the shuffle link
    $shuffle = '/song/shuffle';
    return ListPage::render('Songs', null, $shuffle, false, $list);
});
//		song/1 	- load ALL songs, play song=1, go to nowplaying
//
$klein->respond('GET', '/song/[:song]', function ($request, $response) {
    // get parameter
    $song = $request->param('song');
    $song = $song == 'shuffle' ? 'shuffle' : Music::decode($song);
    // clear the playlist
    Music::send('clear');
    // get the list of songs
    $songs = Song::getList();
    // load the playlist with the requested songs (and figure out the current
    // song position)
    $pos = 0;
    for ($i = 0; $i < count($songs); $i++) {
Example #13
0
 public static function processListPageSecurity($table)
 {
     //	user has necessary permissions
     if (Security::checkPagePermissions($table, "S")) {
         return true;
     }
     $mode = ListPage::readListModeFromRequest();
     //	check special permissions like lookup mode
     if ($mode == LIST_LOOKUP && ListPage::checkLookupPermissions($table)) {
         return true;
     }
     //	page can not be displayed. Redirect or return error
     //	return error if the page is requested by AJAX
     if ($mode != LIST_SIMPLE) {
         Security::sendPermissionError();
         return false;
     }
     // The user is logged in but lacks necessary permissions
     // redirect to List page or Menu.
     if (isLogged() && !isLoggedAsGuest()) {
         HeaderRedirect("menu");
         return false;
     }
     //	Not logged in
     // 	redirect to Login
     //	Current URL is already saved in session
     redirectToLogin();
     return false;
 }