added: issues ticket system

added functions: ticket, createticket, editticket
         (there is no 'rm' function working for tickets yet)
changed: mount parser and mount points
         now we have more parameters (arguments in parameters)
some refactoring in functions 'emacs' and 'mkdir'



git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@554 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-01-25 04:52:17 +00:00
parent 356e93914b
commit 89daf6489d
48 changed files with 2856 additions and 874 deletions

View File

@@ -16,23 +16,34 @@
Mounts::Mounts()
{
pmount = 0;
}
// reading from 'mounts'
void Mounts::ReadMounts(const std::string & mounts)
Error Mounts::ReadMounts(const std::string & mounts)
{
MountParser mp;
Error err = mp.Parse(mounts, mount_table);
Error err = mp.Parse(mounts, mount_tab);
if( err != Error::ok )
{
log << log1 << "M: some problems with mountpoints (mountpoints table will be empty)" << logend;
mount_table.clear();
mount_tab.clear();
}
CalcCurMount();
return err;
}
// reading from /etc/fstab
void Mounts::ReadMounts()
Error Mounts::ReadMounts()
{
static std::string file = "fstab";
@@ -41,7 +52,7 @@ void Mounts::ReadMounts()
if( !etc )
{
log << log1 << "M: there is no /etc directory" << logend;
return;
return Error::no_item;
}
Item fstab;
@@ -50,81 +61,63 @@ void Mounts::ReadMounts()
if( err == Error::no_item )
{
log << log1 << "M: there is no /etc/fstab file" << logend;
return;
return err;
}
if( err != Error::ok )
{
log << log1 << "M: cannot read /etc/fstab" << logend;
return;
return err;
}
ReadMounts(fstab.content);
}
/*
Mount Mounts::GetCurrentMountPoint()
{
return current_dir;
}
*/
Mount::Type Mounts::CurrentMountType()
{
return current_dir.type;
}
bool Mounts::CurrentMountIsParam(Mount::Param p)
{
return current_dir.IsParam(p);
}
bool Mounts::CurrentMountIsParam(Mount::Param p, int * first_arg)
{
return current_dir.IsParam(p, first_arg);
return ReadMounts(fstab.content);
}
void Mounts::MountCmsForRoot()
{
current_dir.type = Mount::cms;
Mount mount;
mount.type = Mount::cms;
Item * proot = data.dirs.GetRootDir();
if( proot )
current_dir.dir_id = proot->id;
mount.dir_id = proot->id;
else
{
current_dir.dir_id = -1;
mount.dir_id = -1;
log << log1 << "M: there is no a root dir" << logend;
}
std::pair<MountTab::iterator, bool> res = mount_tab.insert( std::make_pair(mount.dir_id, mount) );
pmount = &(res.first->second);
}
void Mounts::CalculateCurrentMountType()
void Mounts::CalcCurMount()
{
std::vector<Item*>::reverse_iterator i;
// when the program starts (when the dir_table is empty()
// we don't want to call MountCmsForRoot()
if( request.dir_table.empty() )
return;
for(i = request.dir_table.rbegin() ; i!=request.dir_table.rend() ; ++i)
{
std::map<long, Mount>::iterator m = mount_table.find( (*i)->id );
std::map<long, Mount>::iterator m = mount_tab.find( (*i)->id );
if( m != mount_table.end() )
if( m != mount_tab.end() )
{
current_dir = m->second;
log << log2 << "M: current mount point is: " << current_dir.TypeToStr() << logend;
pmount = &(m->second);
log << log2 << "M: current mount point is: " << pmount->TypeToStr() << logend;
return;
}
}
// if nothing was found
// we assume that 'cms' mount point is used
MountCmsForRoot();
log << log2 << "M: current mount point is: cms (default)" << logend;