예제 #1
0
파일: objectPicker.php 프로젝트: Gutza/LPC
function rbr($row,&$rowData)
{
	global $obj;
	$td=new LPC_HTML_node('td');
	$row->a($td);
	$td->a("[<a href='#' onClick='return LPC_scaffolding_pick(\"".addslashes($rowData[$obj->dataStructure['id_field']])."\")'>"._LS('scaffoldingPickThis')."</a>]");
	return true;
}
예제 #2
0
파일: objectMany.php 프로젝트: Gutza/LPC
function rbr($row,&$rowData)
{
	global $obj, $rObj;
	$td=new LPC_HTML_node('td');
	$row->a($td);
	$cid=$rowData[$obj->dataStructure['id_field']];
	if ($rObj->createLink($_GET['rd'],$cid,1)) {
		$url = LPC_URI::getCurrent()->setVar('crid', $cid)->toString();
		$td->a("[<a href='".$url."'>"._LS('scaffoldingRemoveThis')."</a>]");
	} else {
		$url = LPC_URI::getCurrent()->setVar('caid', $cid)->toString();
		$td->a("[<a href='".$url."'>"._LS('scaffoldingAddThis')."</a>]");
	}
	return true;
}
예제 #3
0
파일: index.php 프로젝트: Gutza/LPC
<?php

require "common.php";

$p=LPC_Page::getCurrent();
$p->title=_LS('scaffoldingTitle');
$p->st();

$p->a("<div>"._LH('scaffoldingMsgAvailableClasses')."</div>");
$list=new LPC_HTML_node('ul');
$p->a($list);

$classes=exposeDirClasses(LPC_classes);
foreach($LPC_extra_class_dirs as $dir)
	$classes=array_merge($classes,exposeDirClasses($dir));

array_multisort(
	$classes['formal'],SORT_ASC, SORT_STRING,
	$classes['name'],SORT_ASC, SORT_STRING
);
foreach($classes['name'] as $idx=>$className) {
	$classFormal=$classes['formal'][$idx];
	$xtra="";
	if (isset($className::$formalDesc))
		$xtra=" &mdash; <i>".$className::$formalDesc."</i>";
	$list->a("<li><a href='objectList.php?c=".rawurlencode($className)."'>$classFormal</a>$xtra</li>");
}
예제 #4
0
	public function prepare()
	{
		$this->ownerDocument->content['head']->content['LPC list filter CSS']=new LPC_HTML_link('stylesheet','text/css',LPC_css."/LPC_list_filter.css");

		$default=addslashes($this->getCurrentValue());

		$form=new LPC_HTML_form(false,'get');
		$this->searchForm=$form;
		$this->a($form);
		foreach($_GET as $key=>$value) {
			if ($key==$this->GET_key)
				continue;
			$form->a("<input type='hidden' name='$key' value=\"".addslashes($value)."\">");
		}

		$table=new LPC_HTML_node('table');
		$table->setAttr('class','table_filter');
		$form->a($table, 'filterTable');

		$tr=new LPC_HTML_node('tr');
		$table->a($tr, 'filterTR');

		$td=new LPC_HTML_node('td');
		$td->setAttr('class','table_filter');
		$tr->a($td, 'filterTD');
		$td->a("<input type='hidden' name='".$this->listObject->getParam('p')."' value='1'>");

		$td=new LPC_HTML_node('td');
		$td->setAttr('class','table_filter');
		$tr->a($td, 'filterControls');
		$td->a(
			"<button type='submit' style='border: none; background: none; padding: 0px'>".
			$this->getIcon("search", _LS('lpcFilterIcon'))."
			</button>"
		);
		if (strlen($default))
			$td->a(
				"<a href='".LPC_URI::getCurrent()->delVar($this->GET_key)->toString()."'>".
				$this->getIcon("remove", _LS('lpcRemoveFilterIcon')).
				"</a>"
			);

		if (isset($this->helpKey)) {
			$td->a(
				"<a href='#' onClick='alert(".self::JS_translation_var.".".$this->helpKey."); return false;'>".
				$this->getIcon("info").
				"</a>"
			);
			if (!isset($this->ownerDocument->content['head']->content['JS_help_'.$this->helpKey])) {
				$js=new LPC_HTML_script();
				$this->ownerDocument->content['head']->content['JS_help_'.$this->helpKey]=$js;
				$js->a("
if (typeof ".self::JS_translation_var." == 'undefined')
	var ".self::JS_translation_var." = {};
".self::JS_translation_var.".".$this->helpKey."=\"".str_replace("\n","\\n",str_replace("\r","",addslashes(_LS($this->helpKey))))."\";
				");
			}
		}
	}
예제 #5
0
파일: LPC_User.php 프로젝트: Gutza/LPC
	function sendRecover()
	{
		if (!$this->generateToken())
			return false;

		$subject=_LS(
			$this->token_recover_subject,
			LPC_project_full_name // {0}
		);
		$body=_LS(
			$this->token_recover_body,
			$this->getName(), // {0}
			LPC_project_name, // {1}
			LPC_project_full_name, // {2}
			$this->processTokenURL(), // {3}
			$this->getAttr($this->user_fields['email']) // {4}
		);

		return $this->sendTokenMail($subject,$body);
	}
예제 #6
0
파일: LPC_Object.php 프로젝트: Gutza/LPC
	public function getScaffoldingEditRow($attName,$options=array())
	{
		$row=$this->getScaffoldingFileRow($attName,$options);
		if ($row!==false)
			return $row;

		$link="";
		if (isset($this->dataStructure['fields'][$attName]['link_class'])) {
			$class=$this->dataStructure['fields'][$attName]['link_class'];
			if (
				$this->id &&
				$this->getAttr($attName)
			) {
				$obj=$this->getObject($attName);
				$name=$obj->getNameH();
				if ($name)
					$name=" (".$name.")";
				$link=$name." <a href='objectEdit.php?c=".rawurlencode($class)."&amp;id=".rawurlencode($this->getAttr($attName))."'>"._LS('scaffoldingEditLink',htmlspecialchars($class),$this->getAttrH($attName))."</a>";
			}
			$link.=" <a href='#' onClick='return LPC_scaffolding_pickObject(\"".addslashes($class)."\",$(this).prevAll(\"input\").get(0))'>☞</a>";
		}
		if (!$this->id)
			$this->setAttr($attName,$this->getScaffoldingDefault($attName));
		$type="";
		if (isset($this->dataStructure['fields'][$attName]['type']))
			$type=$this->dataStructure['fields'][$attName]['type'];
		switch($type) {
			case 'integer':
				$input="<input type='text' name='attr[$attName]' size='6' value=\"".$this->getAttrH($attName)."\">".$link;
				break;
			case 'date':
				if ($val=$this->getAttr($attName))
					$val=date('Y-m-d',$val);
			case 'datetime':
				if (!isset($val) && ($val=$this->getAttr($attName)))
					$val=date('Y-m-d H:i',$val);
				$input=
					"<input type='text' name='attr[$attName]' value=\"".$val."\" class='input-date' id='attr_$attName'>".
					"<input type='button' value=\"".addslashes(_LS('scaffoldingSetDateNow'))."\" onClick=\"$('#attr_$attName').val('+0 minutes')\">";
				break;
			case 'longtext':
			case 'html':
				// HTML + longtext
				$input = new LPC_HTML_node('textarea');
				$input->setAttrs(array(
					'name' => "attr[$attName]",
					'style' => 'width: 100%; height: 150px',
				));
				$input->a($this->getAttrH($attName));
				if ('longtext' == $type)
					break;

				// HTML only
				$input->setAttr('style', $input->getAttr('style')."; min-width: 600px; height: 250px");
				$input = new LPC_HTML_html_editor($input, true);

				break;
			case 'boolean':
				if ($this->getAttr($attName)) {
					$checked_yes=" checked";
					$checked_no="";
				} else {
					$checked_yes="";
					$checked_no=" checked";
				}
				$input=
					"<input type='radio' name='attr[$attName]' value='1'$checked_yes id='{$attName}_yes'> <label for='{$attName}_yes'>"._LH('scaffoldingBooleanYes')."</label><br>".
					"<input type='radio' name='attr[$attName]' value='0'$checked_no id='{$attName}_no'> <label for='{$attName}_no'>"._LH('scaffoldingBooleanNo')."</label>";
				break;
			case 'enum':
			case 'set':
				if (!isset($this->dataStructure['fields'][$attName]['options']))
					throw new RuntimeException("You need to define the options explicitly for enum and set fields (key 'options' in the data structure).");
				$input=new LPC_HTML_node('div');

				$inputS=new LPC_HTML_select("attr[$attName]");
				$input->a($inputS);
				if ($type=='set') {
					// Allow for an empty set by providing an empty option which will be processed on POST
					$input->a("<input type='hidden' name=\"attr[$attName][]\" value='NULL'>");

					$inputS->setAttr('name',"attr[$attName][]");
					$inputS->setAttr('multiple','multiple');
					$inputS->setAttr('size',min(5,count($this->dataStructure['fields'][$attName]['options'])));
				}
				$values=explode(",",$this->getAttr($attName));
				foreach($this->dataStructure['fields'][$attName]['options'] as $option) {
					$optionH=new LPC_HTML_node('option');
					$optionH->compact=true;
					if (in_array($option,$values))
						$optionH->setAttr('selected',1);
					$optionH->setAttr('value',addslashes($option));
					$optionH->a(htmlspecialchars($option));
					$inputS->a($optionH);
				}
				break;
			default:
				$input="<input type='text' name='attr[$attName]' oninput=\"LPC_scaffolding_onTextInput(this)\" value=\"".$this->getAttrH($attName)."\" style='width:90%;'>".$link;
		}
		if (isset($this::$scaffoldingDesc[$attName]))
			$attDesc=_LS($this::$scaffoldingDesc[$attName]['name']);
		else
			$attDesc=$attName;
		if (empty($options['NO_SQL_DESC'])) {
			$rs=$this->query("DESCRIBE ".$this->getTableName()." ".$this->getFieldName($attName,true));
			$attDesc = "<span title=\"".htmlspecialchars($rs->fields['Type'])."\">".$attDesc."</span>";
		}
		if (isset($this::$scaffoldingDesc[$attName]['desc']) && empty($options['NO_LPC_DESC']))
			$attDesc.="<div style='font-weight:normal; font-size:80%'>"._LS($this::$scaffoldingDesc[$attName]['desc'])."</div>";

		$row=new LPC_HTML_form_row(array(
			'label'=>$attDesc,
			'input'=>$input,
		));
		$row->compact=true;
		return $row;
	}
예제 #7
0
파일: welcome.php 프로젝트: Gutza/LPC
}

$form=new LPC_HTML_node('form');
$form->setAttr('method','post');
$form->setAttr('action',$_SERVER['PHP_SELF']);
$p->a($form);

$info=new LPC_HTML_node('div');
if ($u->getAttr($u->user_fields['password'])) {
	$info->a(_LH('lpcAuthResetFormInfo',_LS('lpcAuthCancelResetButton')));
	$reset="<input type='button' name='reset' value='"._LS('lpcAuthCancelResetButton')."' onClick='document.forms[0].reset_password.value=1; document.forms[0].submit()'>";
	$label=_LS('lpcAuthResetPasswordButton');
} else {
	$info->a(_LH('lpcAuthCreatePasswordFormInfo'));
	$reset="&nbsp;";
	$label=_LS('lpcAuthCreatePasswordLabel');
}
$info->a(<<<EOINFO
<input type='hidden' name='e' value="{$_REQUEST['e']}">
<input type='hidden' name='t' value="{$_REQUEST['t']}">
<input type='hidden' name='reset_password' value="0">
EOINFO
);
$form->a($info);

$table=new LPC_HTML_node('table');
$table->setAttr('class','default');
$table->setAttr('style','margin-top: 10px');
$form->a($table);

$table->a("
예제 #8
0
}

if (!empty($_POST['email'])) {
	// Requesting e-mail
	$us=LPC_User::newUser();
	$us=$us->search($us->user_fields["email"],$_POST['email']);
	if ($us && !$us[0]->sendRecover())
		$p->a(new LPC_HTML_error(_LH('lpcAuthErrFailEmail',$_POST['email'])));
	else
		$p->a(new LPC_HTML_confirm(_LH('lpcAuthConfirmRecoverEmail',$_POST['email'])));
	return;
}

$form=new LPC_HTML_form();
$p->a($form);
$div=new LPC_HTML_node('div');
$form->a($div);
$div->a("
<table>
<tr>
	<td>"._LS('lpcAuthRecoverEmailField')."</td>
	<td><input type='text' name='email' id='email'></td>
</tr>
<tr>
	<td>&nbsp;</td>
	<td><input type='submit' name='submit' value='"._LS('lpcAuthRecoverButton')."'></td>
</tr>
</table>");

$p->a("<script type='text/javascript'>document.getElementById('email').focus();</script>");
예제 #9
0
파일: debug.php 프로젝트: Gutza/LPC
	return;
}

$u=LPC_User::newUser();
$u->idFromArrayKey($_REQUEST, 'user_id');

$f=new LPC_HTML_form();
$p->a($f);
$f->a(htmlspecialchars(_LS('rightsTestUserID')).": <input type='text' name='user_id' value='".$u->id."'> ");
$f->a("<input type='submit' name='submit' value='"._LS('rightsTestSubmit')."'>");

if (!$u->id)
	return;

if (defined('LPC_project_class') && LPC_project_class)
	$prj=LPC_Project::getCurrent();
else
	$prj=NULL;

$cache=LPC_Cache::getCurrent();
$t=new LPC_HTML_table();
$p->a($t);
$t->a("<tr><th>"._LS('rightTestUserDate')."</td><td>".date('r', $cache->getUPf(LPC_User::PD_KEY, $u->id))." (".($u->validatePermissionsCache()?"VALID":"INVALID").")</td></tr>");
$t->a("<tr><th>"._LS('rightTestGlobalExpDate')."</th><td>".date('r', $cache->getG(LPC_User::PE_KEY))."</td></tr>");
$t->a("<tr><th>"._LS('rightTestUserExpDate')."</th><td>".date('r', $cache->getU(LPC_User::PE_KEY, $u->id))."</td></tr>");
if ($prj) {
	$t->a("<tr><th>"._LS('rightTestProjectExpDate')."</th><td>".date('r', $cache->getP(LPC_User::PE_KEY, $prj->id))."</td></tr>");
	$t->a("<tr><th>"._LS('rightTestUserProjectExpDate')."</th><td>".date('r', $cache->getUP(LPC_User::PE_KEY, $u->id, $prj->id))."</td></tr>");
}
$t->a("<tr><th>"._LS('rightTestUserPermissions')."</th><td><pre>".print_r($cache->getUPf(LPC_User::P_KEY, $u->id),1));
예제 #10
0
파일: objectList.php 프로젝트: Gutza/LPC
$obj=new $class();
if ($obj->hasScaffoldingRight('W')) {
	$editDiv=new LPC_HTML_node('p');
	$editDiv->a("[<a href='objectEdit.php?c=$class'>"._LS('scaffoldingCreateObject',$class)."</a>]");
	$p->a($editDiv);
}

$refdata=array('rd','rc','rid');
$rd=NULL;
foreach($refdata as $refatom) {
	if (isset($_POST['LPC_scaffolding_'.$refatom]))
		$$refatom=$_POST['LPC_scaffolding_'.$refatom];
	elseif (isset($_GET[$refatom]))
		$$refatom=$_GET[$refatom];
}
$query=$rObj=NULL;
if (strlen($rd)) {
	$rObj=new $rc($rid);
	if (!$rObj->probe()) {
		$p-a(new LPC_HTML_error(_LH('scaffoldErrorMissingRemote')));
		return;
	}
	$editDiv->a(" &bull; [<a href='objectEdit.php?c=".$_GET['rc']."&amp;id=".$_GET['rid']."'>"._LS('scaffoldingBackToParent',htmlspecialchars($_GET['rc']),htmlspecialchars($_GET['rid']))."</a>]");
	$query=$rObj->_makeGetLinksQuery($rd);
}
$p->a($obj->getScaffoldingList($query, $rObj, $rd));

if ($editDiv)
	$p->a($editDiv);

예제 #11
0
파일: changeVisi.php 프로젝트: Gutza/LPC
if (empty($_REQUEST['c'])) {
	$p->a(new LPC_HTML_error(_LH('scaffoldingErrorNeedClass')));
	return;
}

$class=$_REQUEST['c'];
if (!validClassName($class) || !validateClassRights($class)) {
	$p->a(new LPC_HTML_error(_LH('genericErrorRights')));
	return;
}

$p=LPC_Page::getCurrent();
$p->st(_LS('scaffoldingColumnVisibilityTitle', $class));

$p->a("<p>".
	"[<a href='objectList.php?c=".$class."'>"._LS('scaffoldingBackToList')."</a>]".
	"</p>");

$p->a("<p>"._LH('scaffoldingColumnVisibilityExplain')."</p>");

$obj=new $class();
$allAttrs=$obj->sGetAllAttributes();
$visAttrs=$obj->sGetVisibleAttributes();
$defAttrs=$obj->sGetDefaultVisibleAttributes();

if (!empty($_POST['diff'])) {
	$diff=$_POST['diff'];
	if (empty($_POST['visi'][$diff]))
		$new=false;
	else
		$new=true;